Following How many interior and exterior rings can a polygon have in a standard ArcGIS shapefile?, can I have a mixture of two kinds of geometry in a shapefile of type point. Just like I have about shapefiles of type polygon or I should always create a shapefile of type multipoint in order to support multipoints in my layer?

My problem is as you see at How can I use ogrinfo to reach information about a .shp?, I can't use ogrinfo in order to understand that the geometry type of a multipoint shapefile will be known as wkbMultipoint or wkbPointwhen I use this line of code:

OGRwkbGeometryType GeometryType = poLayer ->GetGeomType();  

for a layer of type multipoint before programming.

  • Will OGR know a layer of type multipoint as wkbpoint or wkbmultipoint?
  • When we create a shapefile in ArcCatalog, we have point and multipoint, but not multipolyline or multipolygon for polyline and polygon.Why?

closed as too broad by PolyGeo Jul 13 '16 at 23:15

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • As per the Tour there should be only one question asked per question. – PolyGeo Jul 13 '16 at 23:16

Quoting the shapefile specification (page 4):

All the non-Null shapes in a shapefile are required to be of the same shape type.

You may choose point OR multipoint OR polygon, but you cannot use multiple geometry types in a single shapefile. Multi-part geometries are permitted in all flavors of multipoint, polyline, and polygon shapefiles.

  • but @Vince as you suggested yesterday I can have two kinds of geometry in a shapefile. for example a polygon shapefile that has features of type wkbPolygon and wkbMultipolygon. have you considered this link – Sepideh Abadpour Sep 13 '13 at 17:45
  • when I say multigeometry, I don't mean line and polygon or polygon and point in a shapefile. Of course we can't have this kind of multigeometry shapefiles. I mean it seems that we can have geometries of type OGRPolygon and OGRMultiPolygon in a single shapefile but not geometries of type OGRPoint and OGRMultipoint in a single .shp? maybe the topic of my question is abit confusing! – Sepideh Abadpour Sep 13 '13 at 17:52
  • 1
    The shapefile spec pre-dates OGRPolygon by a decade -- The file format is certainly not bound by GDAL implementation details. I just created a valid multipoint shapefile with four rows, a null shape, a one-vertex multipoint shape, a two-vertex multipoint shape, and a three-vertex multipoint shape, and it renders correctly. You will need to make sure that you use a one-part multipart point, however, since Point encoding is incorrect (it must be a MultiPoint record with NumPoints == 1). – Vince Sep 13 '13 at 19:49
  • @sepideh as noted by Vince the multi-part geometry is different from multi geometry. Since esri released the shape file to open source multi-geometry has been added (by the programming open source community). What this means is a point, polygon, line geometry existing in the same shape file. This IS NOT supported in esri software. multi-parts are an assembly of the same geometry type at the object level. Not the feature class level (which would refer to multi-geometry). see sdf also for multi-geometry data formats. en.wikipedia.org/wiki/Spatial_data_file – Brad Nesom Sep 13 '13 at 20:12
  • @Brad: The shapefile specification isn't subject to change in this manner. You can create files which have ".shp" suffixes, but if they don't conform to the specification, they aren't shapefiles. If developers want to place shapefile-like files into circulation (a dubious goal, IMHO), they ought to change the version number in the header, so that the file is clearly non-conformant. – Vince Sep 13 '13 at 20:58

It depends on the usage and the meaning of "can".
Yes you CAN have multi-geometry type shapefiles.
They are not supported in esri software however. and so some other software will not process them correctly.
As for multi- point that is not the same as a multigeometry types (as I understand).
search for "multi" in the esri technical shape file description pdf. multi search

Also NOTE that if an ent db is a destination for multipoint objects you should use caution working with esri extensions and other 3rd party software.

  • but multigeometry shapefiles are supported in ArcGIS as yo see [here]osgeo-org.1560.x6.nabble.com/…) for polygon and polyline .shps. I wanted to know if multigeometries are supported in point shapefiles too? Or should I create multipoint .shp? I have asked another question too in my post. If you're desired please see the above. – Sepideh Abadpour Sep 13 '13 at 17:13

As for your second question, "When we create a shapefile in ArcCatalog, we have point and multipoint, but not multipolyline or multipolygon for polyline and polygon. Why?" The answer lies in the Whitepaper for the Shapefile format. For a shapefile of a POINT shape type, each point is actually stored in a separate geometry, with it's own header and all. This is actually a terribly inefficient way to store point type data, and so the multipoint shape type is simply a format in which many points can be stored in a single geometry with one header. It is far more efficient. Nonetheless, the one-point-one-geometry shapefile type is far more commonly used. There's no need for a 'multi-polyline' or 'multi-polygon' shape type since the structure of these types of files already allow for multi-part polylines and multi-part polygons. That's why, for example you can have a lake polygon with included island polys that all reside in the same feature within the shapefile. I hope that helps to explain it.

As for different kinds of geometries in the same shapefile, the format is actually capable of this since each stored feature has its own header which specifically indicates the type of the feature. However, the shapefile specs specifically state that shapefiles can only store one shape type. We can only guess that at one time there were plans for a revised version that would allow for multiple shape types within a single file, but that for whatever reasons, it never happened.

  • The Point type file is the most efficient possible to store point data (one vertex per feature). The Multipoint type file is the least efficient way to store single-point features, since it has the overhead of bounding box and vertex count (36 more bytes per feature). Shapefile was never intended to store multiple topology classes in a single file -- they were designed to replace the complexity of coverage format, which did support multiple classes, so the one class per file constraint was a critical design decision. – Vince Sep 4 at 9:32

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