Friday 15 February 2019

geotools - Are mixed geometry types allowed in shapefiles?


Does the shapefile support mixed geometry types (ie. point and polygon all in the same file)?



Answer



Answer can be found from the official specification http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf.



All the non-Null shapes in a shapefile are required to be of the same shape type.  The
values for shape type are as follows:
Value Shape Type
0 Null Shape
1 Point
3 PolyLine
5 Polygon
8 MultiPoint
11 PointZ
13 PolyLineZ

15 PolygonZ
18 MultiPointZ
21 PointM
23 PolyLineM
25 PolygonM
28 MultiPointM
31 MultiPatch

Shape types not specified above (2, 4, 6, etc., and up to 33) are reserved for future use.
Currently, shapefiles are restricted to contain the same type of shape as specified above.

In the future, shapefiles may be allowed to contain more than one shape type. If mixed
shape types are implemented, the shape type field in the header will flag the file as such.

Notice also that points and multipoints can't be saved into same shapefile while lines and polylines can, as well as polygons and multipolygons.


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...