Two days ago I asked a question about the internal storing order for the vertices of a polygon in ESRI shapefiles. That question was answered (Are polygons stored clockwise or counterclockwise in a shapefile?) and it was also answered in an old post (Polygon creation (Clockwise rotation or not))
But now my question is more general, and I don't know if it has an unique answer.
Is the clockwise order only for ESRI shapefiles or for general GIS formats?
And what about the internal representation for a GIS software?
For example, if I use QGIS and I read a *.shp containing polygons I suppose the internal representation of the outer bound is clockwise as in the original shapefile, but what about for all the file formats supported by QGIS?
And for ArcGIS?
And in the case there exists a file format with polygons stored in counterclockwise, if these files are loaded in QGIS, ArcGIS, etc., is the orientation changed internally, so if I read the data using PyQGIS, for example, the polygons are clockwise ordered?
My purpose is to write a plugin for QGIS, but the source of data can be ESRI shapefiles or other formats. As I need to check the angles between consecutive sides of polygons using their azimuths I need to known if the order is clockwise. One solution is computing the area of each polygon and, if I remember correctly, if it is positive the order is clockwise and if negative the order is counterclockwise.
Area computation is not an intensive task, so it will not slow my plugin so much.
But in the special case of QGIS, anybody knows if it stores the polygons clockwise or counterclockwise, regardless the order in the original source?
By now I'm working with ESRI shapefiles and the coordinates in layer.getFeatures().geometry().asPolygon()
are stored in clockwise for the outer border and counterclockwise for the holes, i. e. as in the original *.shp.
Polygons are oriented correctly. (Exterior ring boundaries must be oriented counterclockwise, and interior ring boundaries must be oriented clockwise.)
which means that Oracle is Counterclockwise. – user30184 Jul 26 '16 at 4:59