[Gdal-dev] Possible bug in getGeometryType() version 1.3.0
Chapman, Martin
MChapman at sanz.com
Tue Oct 11 11:58:40 EDT 2005
Frank,
OGRPoint returns an invalid value for getGeometryType(). Something like
-2478353. Doesn't match any of the geom Types. I will upgrade to
1.3.1.
Best regards,
Martin
-----Original Message-----
From: fwarmerdam at gmail.com [mailto:fwarmerdam at gmail.com] On Behalf Of
Frank Warmerdam
Sent: Tuesday, October 11, 2005 9:08 AM
To: Chapman, Martin
Cc: Sean Gillies; gdal-dev at lists.maptools.org
Subject: Re: [Gdal-dev] Possible bug in getGeometryType() version 1.3.0
On 10/10/05, Chapman, Martin <MChapman at sanz.com> wrote:
> Sean,
>
> Ok, I think I figured out the bug. The basic problem I think is that
the shape reader function SHPReadOGRObject () in shape2ogr.cpp creates
the OGRPoint object with x, y, z and in turn the OGRPoint class has an
original dimension of 3. Then he (Frank) calls the function
setCoordinateDimension(2) if the shape type is SHPT_POINT. The problem
being that the function setCoordinateDimension is a virtual function
defined and implemented in ogrgeometry.h/.cpp. OGRLineString and
OGRPolygon override this virtual function and call Make2D() when the
coord dimension is reduced to 2. OGRPoint does not override this
function. The result is that the base class function
setCoordinateDimension() in ogrgeometry gets called for points, and the
Make2D() function is never called. The solution is to implement the
virtual function setCoordinateDimension() in the OGRPoint class and call
Make2D() when dimension == 2.
Martin / Sean,
I'm not sure I follow the issue here. You report that
GetGeometryType() is returning an invalid value. What value is
it returning? Is it just returning a wkbPoint25D? You mention
you are using 1.3.0. Perhaps you should upgrade to 1.3.1. There
was some sort of fix in geometry dimension handling for points
after the 1.3.0 release.
Best regards,
--
---------------------------------------+--------------------------------
------
I set the clouds in motion - turn up | Frank Warmerdam,
warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the Gdal-dev
mailing list