Friday 26 February 2016

Are polygons stored clockwise or counterclockwise in a shapefile?



I'm working with polygon coordinates in QGIS using PyQGIS using ESRI shapefiles as input data.


Are the polygon vertices (I am referring only to the outer boundary in the case of polygons with holes) stored as clockwise or as counterclockwise in a shapefile or can be in mixed order?


Is the order always the same or can be different depending on the source of the data: digitizing, converting from other sources as *.csv files, etc.?



Answer



According to the Shapefile white paper (page 8), polygons are stored in a clockwise fashion except for interior polygon hole parts (i.e. 'donut holes'), which are stored in a counter-clockwise fashion. In fact, that's how polygon holes are recognized.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...