Opened 16 years ago

Closed 12 years ago

#2374 closed defect (fixed)

OGR : Shapefile driver : Possible bug in Coordinate Dimension

Reported by: nbo Owned by: warmerdam
Priority: normal Milestone: 1.9.0
Component: OGR_SF Version: unspecified
Severity: normal Keywords: shape
Cc:

Description

Hello, I have been checking the source code of the OGR shapefile driver.There is a problem with Measures types (Version 1.51). For example, a PointM and a PointZ are considered as 3 dimensions (OGRPoint is initialized with X,Y,Z on both cases,the problem is that PointM has no Z information).Point is considered as 2 dimensions. If we follow the simple feature architecture,Point & PointM are 2 dimensions and Point Z 3.

Attachments (1)

shapefile-measure-support.patch (7.2 KB ) - added by pka 12 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 by nbo, 16 years ago

Forgot to say that this is the same for Lines,polygons....

comment:2 by warmerdam, 16 years ago

Component: defaultOGR_SF
Keywords: shape added
Status: newassigned

First, OGR is based on Simple Features 1.0, so it doesn't properly handle measures. Instead the shapefile driver (may) just wedge it into the Z and threat it as 3 dimensional. If that is the situation, I don't plan to make any changes till we upgrade to Simple Features 1.2 as our base model.

If you have a PointM file where the M is discarded but the dimension is still set to 3 then that might be something I could look into.

comment:3 by nbo, 16 years ago

just a remark,for example : PointM shapefiles (no Z coordinate):

  • The Z coordinate is put into OGRPoint (Z is,in that case always 0.00).

If we want to seek the Simple Features 1.0 spec,we should coords dimensions at 2 for Point and PointM.... Anyway,I have modified the driver in order to support Mesures with an overloaded class.

comment:4 by nbo, 16 years ago

Ex : OGRPointM,derived from OGRPoint => Using RTTI

comment:5 by nbo, 16 years ago

I know that for the moment,OGR does not support Measures...

comment:6 by pka, 12 years ago

Milestone: 1.9.0

The attached patch adds read support for Shapfile measures.

Measures are read as Z values. This opens the possibility to work with M values in OGR clients like QGIS.

comment:7 by warmerdam, 12 years ago

Resolution: fixed
Status: assignedclosed

Patch committed in trunk (r23599) with a slightly different test case. It would be nice to support similar logic when creating xym geometries but I'll leave that for later.

Note: See TracTickets for help on using tickets.