[gdal-dev] [WKTRaster] WKT Raster band to GDAL band

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Mon Mar 8 11:42:18 EST 2010


>4.- Add default geotransform to GDAL empty dataset: {0.0, 1.0, 0.0, 0.0, 0.0,1.0 }; (I can't get
>geotransform from WKT Raster Band)

Why? You can get all the parameters with (in order): rt_raster_get_x_offset(), rt_raster_get_pixel_width(), rt_raster_get_x_rotation(), rt_raster_get_y_offset(), rt_raster_get_y_rotation(), rt_raster_get_pixel_height()...

>1.- I'm testing this code with really simple raster, and I'm confused. For example:
>* 2x2 32 bits signed int raster, with "1" in all cells. The result: POLYGON((0 0, 0 2, 2 2, 2 0, 0
>0)). I was expecting POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))

The result is correct since the pixel size is 1, the raster dimension is 2x2 and there is only one group of pixel sharing the same value.

>* the raster
>from http://trac.osgeo.org/postgis/attachment/wiki/WKTRaster/SpecificationWorking01/WKTRasterEnvelopeC
>onvexHullAndShape.gif. The result:
>POLYGON ((3 1,3 2,2 2,2 3,1 3,1 6,2 6,2 7,3 7,3 8,5 8,5 6,3 6,3 3,4 3,5 3,5 1,3 1))
>POLYGON ((3 3,3 6,6 6,6 3,3 3))
>POLYGON ((5 1,5 3,6 3,6 6,5 6,5 8,6 8,6 7,7 7,7 6,8 6,8 3,7 3,7 2,6 2,6 1,5 1))
>POLYGON ((0 0,0 9,9 9,9 0,0 0),(6 7,6 8,3 8,3 7,2 7,2 6,1 6,1 3,2 3,2 2,3 2,3 1,6 1,6 2,7 2,7 3,8 3,8
>6,7 6,7 7,6 7))
>
>Something strange here? Am I doing things right?

It look good to me. What is wrong?

>2.- I'd like to store the pixel value in each polygon. Is a good idea to create a field in the layer
>to store pixel value?

You are supposed to return the value for each polygon in a "wktgeomval set" as stated in the specs. This way the SQL caller can decide what to do with the value. Isn't that what you did?

>3.- From a GDAL RasterBand, I can fetch the owning dataset handle (GDALGetBandDataset).I think it
>could be useful to get the WKT Raster handle from a WKT RasterBand too... Am I right?

rt_band_get_data()?

Pierre


More information about the gdal-dev mailing list