9

I am working with an Oracle spatial connection in QGIS through which I am accessing and editing a vector layer. I find that when I edit a geometry, the vertex ordering is reversed (to clockwise in the outer ring) which then gets flagged up as an error in oracle.

I am using the combine function (http://www.qgis.org/api/classQgsGeometry.html) among others in my own editing tools, but I notice that this happens with the native merge polygons tool too.

I think this reo-ordering to clockwise is the default in QGIS based on this link: https://hub.qgis.org/issues/6283 and was wondering if there is a way to reverse it to counter clockwise? (preferably with python)

1

1 Answer 1

1

Maybe overdone, but these post might contain some useful hints:

How can I switch line direction in QGIS?

Switch line direction for PostGIS-lines in QGIS or Pgadmin

In PyQGIS the code mentioned there is still valid, I think:

geom = feature.geometry()
nodes = geom.asPolyline()
nodes.reverse() 
newgeom = QgsGeometry.fromPolyline(nodes)
layer.changeGeometry(feature.id(),newgeom)

Since QGIS comes with GRASS support, have a look at v.edit tools=flip https://grass.osgeo.org/grass64/manuals/v.edit.html

[current QGIS version 2.14.5.LTR]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.