[geos-devel] getCoordinateDimension() - ticket 311

Martin Davis mbdavis at refractions.net
Tue May 25 16:56:25 EDT 2010


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.

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

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?

Frank Warmerdam wrote:
> Folks,
>
> Ticket 311:
>
>   http://trac.osgeo.org/geos/ticket/311
>
> raises some dimension related issues. One of them is that getDimension()
> currently returns 2/3 which is really the coordinate dimension, not the
> geometry dimension.  I'm not going to immediately address this issue, but
> I would like to add a getCoordinateDimension() method on the geometry 
> which
> returns the dimension of the coordinates (2 or 3 or in the future 4).
>
> This will be done only in trunk, and reflected also in the C API.  Are 
> there
> any objections to this?
>
> Best regards,

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022



More information about the geos-devel mailing list