Fix polygon ring orientations in esri shapefiles
shprewind infile outfile
Makes a copy of the shapefile infile to outfile and fixes the orientation of points in the rings of Polygon, PolygonZ, and PolygonM typed shapes to conform to the shapefile specification. According to the specification, the vertices of outer rings should be oriented clockwise on the X/Y plane, and those of inner rings counterclockwise.
Shapefiles actually consist of two files with the same basename and extensions .shpand.shx (or .SHPand.SHX) containing the shape data and shape index respectively. The files to open are determined by first stripping any filename extension from infile and attempting to open the files infile.shp or infile.SHP, and infile.shx or infile.SHX for the respective data and index files. The files to create from outfile are determined by stripping any filename extension from outfile and appending .shp and .shx suffixes for the respective data and index files.
0
Successful program execution.
1
Missing infile or outfile arguments, failed to open shapefile infile or create shapefile outfile.
The following diagnostics may be issued on stdout:
Unable to open:infile
Unable to create:outfile
count objects rewound.
Frank Warmerdam ([email protected]) is the maintainer of the shapelib shapefile library. Joonas Pihlaja ([email protected]) wrote this man page.
The implementation assumes that there is at most one outer ring in each shape, that it is the first ring in a shape, and all other rings in a shape are inner rings. Polygons inside MultiPatch shape types aren't rewound.
dbfadd(1), dbfcreate(1), dbfdump(1), dbf_dump(1), shpadd(1), shpcreate(1), shpdump(1)