2

Since a shapefile can only contain a single geometry type (e.g. point, polygon, etc), how could I persist both?

If I must create a shapefile for each geometry type, how can I pass them to a colleague to load? In kml I can just pass the single kml to load. Is there a shapefile manifest equivalent that I am missing?

4
  • 2
    Just send two shapefiles, if it must be one file then zip it with a suitable utility like winZip, 7-Zip.. CAD files can also contain multiple geometry types.. but the question is why is it important to have multiple geometry types in one single 'feature class'? Perhaps if we knew where you were going with this we could help a bit more; it would also help if we could understand what GIS software you and you colleague have. Commented Apr 30, 2015 at 21:50
  • 2
    What software are you using? Is shapefile a requirement, or would a file or personal geodatabase (ArcGIS primarily but some use in QGIS/other) work? There are also commands/plugins that can automatically package all relevant files for a map into a single file for distribution.
    – Chris W
    Commented Apr 30, 2015 at 23:43
  • Related: gis.stackexchange.com/questions/142665/…
    – Chris W
    Commented May 1, 2015 at 1:31
  • Great feedback. I'd been zipping them together as a temporary solution until I could understand better. I am creating shapefiles using geotools from a db but have to provide them to a customer who does use ESRI. I've started using QGIS to view them and verify they work but had been using a geotools viewer I created. My objective is to be able to hand these shapefiles off the best way for the folks using ArcGis. There in lies my limitations on the single geometry. Commented May 1, 2015 at 14:56

3 Answers 3

2

Actually shapefile is an open specification now. Also it "can" support multiple geometry types in one (while it is never just 1 file but a group of files that make a shapefile. which you would still need to either zip or pass more than 1 file anyway).

Wiki shows most of the needed information to what you want to do. BUT I do not recommend it. Only open source software which would be very buggy can handle those types of files.
Any software I have seen that does handle shapefiles with any integrity only handle single geometry shapefile types. NOTE: I do not recommend using multi geometry shapefile for any type of use!

excerpt from Wiki:

Mixing shape types

Because the shape type precedes each geometry record, a shapefile is physically capable of storing a mixture of different shape types. However, the specification states, "All the non-Null shapes in a shapefile are required to be of the same shape type." Therefore this ability to mix shape types must be limited to interspersing null shapes with the single shape type declared in the file's header. A shapefile must not contain both polyline and polygon data, for example, and the descriptions for a well (point), a river (polyline), and a lake (polygon) would be stored in three separate datasets.

As a note: I have seen some movement toward utilizing the "zipped" shapefile as a single drag and drop type entity on some web mapping/processing sites [fme]. (I haven't seen it used in any desktop software yet).
ArcGIS.com does support drag and drop of csv and txt files inside of a zip file.

3
  • 1
    QGIS supports displaying and editing of zipped shapefiles...! Commented Apr 30, 2015 at 22:18
  • Nice! Shapefiles supporting more than one geometry type, maybe so under the strict implementation of the current spec, I can say for sure that Esri doesn't support it and I seriously doubt that OGR does either in its current state (therefore QGIS and all the other open source that uses OGR). Zipped shapefiles need to be unzipped before they can be used. If this implementation becomes utilized that may put an end to the shapefile being the common link between software. Perhaps Esri geodatabase would be an alternative: multiple feature classes, one file. Commented Apr 30, 2015 at 22:19
  • 2
    Just because the specification for shapefiles is open doesn't mean it's an open file type. If you were to create a "shapefile" with multiple geometry types, it wouldn't in fact be a shapefile, but corrupt data in the guise of a shapefile (and unable to be shared usefully). And that wouldn't address the core complaint of the OP -- shapefiles are still at least three physical files (and .prj would make four).
    – Vince
    Commented May 1, 2015 at 1:16
2

For documentary purposes added in 2019 (!): there are now exchange options which can contain all kinds of spatial (and non-spatial) information. Geopackages look promising.

@all: feel free to add other options. This is a community wiki now.

0

Intergraph's Geomedia has supported multigeometry layers for a decade, I've never understood why ESRI has stood by this arbitrary splitting of data into shape types. Also, more frustratingly, why the 10 character limit for field names?

ESRI update your standard/specification already! it's not the 90's anymore, computers can now handle 20, maybe even 30 characters if you're really careful. 50 character field names might blow up someones computer though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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