[geos-devel] getCoordinateDimension() - ticket 311

Frank Warmerdam warmerdam at pobox.com
Tue May 25 21:27:16 EDT 2010


Martin Davis wrote:
> In JTS Geometry.getDimension() follows the OGC semantics, and returns 
> the dimension of the geometry (not the coordinates).
> 
> So this looks like a bug in GEOS.  IMO this should be fixed.

Martin,

I should clarify.  On deeper examination the only getDimension() that
was not returning the geometry dimension was the C API wrapper one.  I'm
not sure why. So the C++ is getDimension() is already right.

I think we will have to change the values returned by the C API getDimension
function to match C++ even though this introduces a modest risk of problems
for applications using the undocumented current behavior.

> Adding a getCoordinateDimension seems like a good idea.  What would this 
> return for coordinates which have XYM?  Would it work for empty geometries?

Well, GEOS does not yet have any M support.

> Maybe strk is right, and this should be changed to an enum. Perhaps the 
> enum could be defined as
> 
> XY = 2
> XYZ = 3
> XYZM = 4
> XYM = 5 ?
> 
> Or perhaps there is already a convention covering this?

My personal opinion is that the interpretation of the coordinate
dimensions should not be directly mixed into getting the number
of coordinate dimensions.  But I could be wrong headed on this.

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 geos-devel mailing list