Changes between Initial Version and Version 1 of Ticket #2124


Ignore:
Timestamp:
Dec 30, 2007, 8:07:16 AM (16 years ago)
Author:
warmerdam
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #2124

    • Property Keywords shape added
    • Property Status newassigned
    • Property Component UtilitiesOGR_SF
  • Ticket #2124 – Description

    initial v1  
    11I discovered a bug in shapelib and how it handles Z and M data.
    22What I did was converting a Polygon shapefile to PolygonZ using:
     3{{{
    34 OGR2OGR.exe -f "ESRI Shapefile" countriesZ.shp countries.shp -lco SHPT=PolygonZ
    4  
     5}}}
    56At the shapefile page, there is this warning: "Shapefiles with measure values are not supported".
    67 
    78The thing is that you cannot create a shapefile with Z values without also having measure values. Its either XY, XYM or XYZM (see the spec). I confirmed this with files created using ArcCatalog, and sure enough that's how it is (In ArcCatalog you can choose to only have Z values in the file, but it really creates a Z+M file).
    8  
     9
    910The problem is that the shapetype header is set to 15 (=PolygonZ*) so a shapefile reader will think there are both Z and M values in the file. Shapereaders that ignores Z and M doesn't have a problem, but if they are read, they are either incorrect or will risk getting a EOF exception.
     11
    1012*The same thing of course goes for points and polylines.
    11  
     13
    1214Technically what OGR really creates with the above command is PolygonM, but with an incorrect shapetype value. So the quickest fix would be to change the shapetype to 25 (generally add 10) and change the warning to "Shapefiles with Z values are not supported" (although adding support for both Z and M would of course be the best, and still fairly straighforward).