Opened 8 years ago

Closed 8 years ago

#6379 closed defect (fixed)

shapefile Perl tests broken due to change in driver

Reported by: Even Rouault Owned by: Ari Jolma
Priority: normal Milestone: 2.1.0
Component: PerlBindings Version: unspecified
Severity: normal Keywords:
Cc: Ari Jolma

Description

Ari,

I updated the shapefile driver not to declare the M type at layer geometry type level if the M values are the ESRI nodata ones, and it broke the Perl tests in t/00-measures-03.t . Would you mind updating them ?

Change History (4)

comment:1 by Ari Jolma, 8 years ago

The tests that fail are testing the SHPT=type option. Specifically those where the type contains M. The idea of the test is that while the layer type can be for example POINT but the shapefile is created as POINTM forcing the type to PointM when the shapefile is opened again... Hm. Doesn't the change make SHPT not work if the requested type contains M?

comment:2 by Even Rouault, 8 years ago

I'm not sure to have fully understood your above comment, but we cannot have perfect round-tripping due to both wkbPointZ and wkbPointZM layer geometry types (or equivalently asking for SHPT=POINTZ or SHPT=POINTZM) being translated as shape SHPT_POINTZ, but in the case of POINTZ in the OGR/non-strictly-conformant way, and in the POINTZM way in the conformant-way. Let's take an example where in the 3 cases SHPT_POINTZ will be the written layer geometry type in the shapefile header (as well as the type of the individual shape in the shape object header)

Requested layer type  Passed geometry    Written values in .shp   Read geom type Read geom
wkbPointZM            POINT ZM (1 2 3 4)      1 2 3     4         wkbPointZM     POINT ZM(1 2 3 4)  
wkbPointZM            POINT Z (1 2 3)         1 2 3 -1.xe308      wkbPointZ      POINT Z (1 2 3)  
wkbPointZ             POINT Z (1 2 3)         1 2 3 (no m at all) wkbPointZ      POINT Z (1 2 3)  

Case 1 is the straightword one Case 2 is the new logic I added today so that "compliant" shapefiles generated by ArcGIS that have no real M values are seen by OGR as just XYZ (and I also fixed the write side to write -std::numeric_limits<double>::max() instead of 0 when the geometry has no M dimension) Case 3 is the way OGR has always do, but as we discovered from recent discussion on the mailing list and closure look to the shapefile spec, isn't really compliant to the spec.

So if you take for example the following .csv file

id,WKT
1,"POINT Z (1 2 3)"

and do

ogr2ogr pointz_ogr_way.shp pointz.csv -nlt pointz
ogr2ogr pointz_esri_way.shp pointz.csv -nlt pointzm

both are read the same by OGR, except that the second one is larger than the first one.

Last edited 8 years ago by Even Rouault (previous) (diff)

comment:3 by Ari Jolma, 8 years ago

I believe SHPT works but it is not testable if we drop M if it has no data values. But I see you added ADJUST_GEOM_TYPE whose NO can be used. So I believe the correct fix to those tests is to use that.

comment:4 by Ari Jolma, 8 years ago

Resolution: fixed
Status: newclosed

Fixed in r33582

Note: See TracTickets for help on using tickets.