[gdal-dev] How to get the size of a OGRGeometry

Frank Warmerdam warmerdam at pobox.com
Tue Jul 7 20:28:17 EDT 2009


Jorge Arévalo wrote:
> I'm talking about the nRasterXSize, nRasterYSize of a GDALDataset
> (this is what I mean with "size"). In the context of the GDAL WKT
> Raster driver, I can get the extent covered by a raster getting the
> "extent" column from RASTER_COLUMNS table. If I read this column like
> an OGRGeometry object, with an OGREnvelope, I can get the upper left
> coords (poE->MinX, poE->MinY?) and the extent of the raster. But I'm
> not sure if my operations are correct or there is a better way to do
> this

Jorge,

Taking the width and height of the extent geometry envelope and then
dividing by the pixel size values from RASTER_COLUMNS (pixelsize_x
and pixelsize_y) will give you the width and height of the raster in
pixels for regular_blocking rasters.

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