[gdal-dev] How to get the size of a OGRGeometry
Frank Warmerdam
warmerdam at pobox.com
Tue Jul 7 18:31:06 EDT 2009
Jorge Arévalo wrote:
> Hello,
>
> If I have an OGRGeometry object (said poGeom), I can get its coords by:
>
> OGREnvelope * poE = new OGREnvelope();
> poGeom->getEnvelope(poE);
>
> // poE->MinX, poE->MinY, poE->MaxX, poE->MaxY are the limit coords
>
> If I want the size of the Geometry:
>
> double dSizeX = poE->MaxX - poE->MinX;
> double dSizeY = poE->MaxY - poE->MinY;
>
> Is it the correct way?
Jorge,
This is appropriate for finding the width and height of the
bounding box. Is that what you mean when you say "size"? Size
is not a well defined term all on it's own.
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