[postgis-devel] Two questions about wktraster development

Mateusz Loskot Mateusz.Loskot at cadcorp.com
Tue Sep 22 06:11:51 PDT 2009


Jorge Arévalo wrote:
> Hello everybody,
> 
> During this summer, I took part in Google Summer of Code, developing
> the WKT Raster driver for GDAL. After the program, I'm going to carry
> on with the project. Just now, I'm testing 2 features I couldn't test
> properly during GSoC. These are out-db raster support and endianess.
> And I've a couple of questions:
> 
> - Out-db support: I modified the gdal2wktraster script to add out-db
> support [1]. I had to "hack" the WKT Raster extension code to allow
> out-db rasters too. I simply commented the lines 532-535 of
> $WKTRASTER_SRC/rt_pg/rtpostgis.sql file (out-db checking).

You probably mean these lines:

http://trac.osgeo.org/postgis/browser/spike/wktraster/rt_pg/rtpostgis.sql.in.c#L539

> Is it a good way of doing this? Temporarily, of course.

Yes, it is as long as the out-db support is provided/ready.

> - Endianess: I tried to insert raster data with different endianess
> than my machine, but when the INSERT was executed, the endianess was
> changed to the correct one. At which level does it happen? WKT Raster
> extension level, PostgreSQL level? I couldn't apply a "hack" here...

It is correct behaviour.
You insert data indirectly calling RASTER_in function:

http://trac.osgeo.org/postgis/browser/spike/wktraster/rt_pg/rt_pg.c#L260

The first byte of raster WKB stream indicates endianness.
This flag is used by WKB parser to read "real numbers" from WKB stream:

http://trac.osgeo.org/postgis/browser/spike/wktraster/rt_core/rt_api.c#L1865

Then object composed of "real numbers" is serialised
according to native properties of host machine:

http://trac.osgeo.org/postgis/browser/spike/wktraster/rt_core/rt_api.c#L2367

I hope it does make sense.

Best regards,
--
Mateusz Loskot
Senior Programmer, Cadcorp
http://www.cadcorp.com



****************************************************************************
This email is confidential and may be privileged and should not be used, 
read or copied by anyone who is not the  original intended recipient. If you 
have received this email in error  please inform the sender and delete it 
from your mailbox or any other storage mechanism. Unless specifically 
stated, nothing in this email constitutes an offer by Cadcorp and Cadcorp 
does not warrant that any information contained in this email is accurate. 
Cadcorp cannot accept liability for any statements made which are clearly 
the sender's own and not expressly made on behalf of Cadcorp or one of its 
agents. Please rely on your own virus check. No responsibility is taken by 
Cadcorp for any damage arising out of any bug or virus infection. 
****************************************************************************


More information about the postgis-devel mailing list