[gdal-dev] Raster/vector intersections in PostGIS WKT Raster

christian.mueller at nvoe.at christian.mueller at nvoe.at
Wed Jun 30 10:29:42 EDT 2010


No, I did not consider GDAL/Georaster. The reasons are

1)
There is already a plugin (imagemosaic-jdbc) for fetching  images from  
jdbc databases supporting Oracle Location Based Services, Postgis, DB2  
spatial extender and jdbc databases without a spatial extension.

I did not want to add a new dependency only for Oracle Georaster.  
Before I wrote this plugin, I developed the gdal_retile.py utility to  
prepare the image data.

As a consequence,  I only added   a GeoRaster  sql access layer  
fetching a cropped image from the best fitting pyramid and passing  
this image back to the geotools plugin for further processing.

2) geotools uses gdal for reading different image formats (Optional).  
This was introduced for file based image access and is supported for  
dedicated versions of gdal. There is always a chance that I would need  
another version, this is to risky for me.

3) Another showstopper was a customer using geotools/geoserver on an  
AIX platform. On this platform there is no JAI native accelerator, so  
I tried to build gdal on AIX  and use the gdal java api to benefit  
from the speed of the gdal library.  After 2 weeks, trying with the  
gnu build tools, ordering the IBM C++ compiler, retried the build, I  
simple gave up.

The GDAL/GeoRaster is really a cool plugin (the whole library is my  
swiss army knife ), but in this situation, things were to complicated.

Cheers
Christian

Quoting Ivan Lucena <ivan.lucena at pmldnet.com>:

> Hi Christian,
>
> I am sorry to spoil this thread. We are suppose to be talking about   
> WKT Raster, but as you mentioned GeoRaster on gdal-dev list I just   
> have to ask you if you have considered or tested using   
> GDAL/GeoRaster. Did you?
>
> There is an ease way to do that, and it works for OSSIM, QGIS,   
> ArcGIS, GRASS or whatever software that uses GDAL. You can build the  
>  GDAL/GeoRaster driver as a plugin (you should have ORACLE_HOME   
> environment variable).
>
> % cd <gdal root>/frmts/georaster
> % make plugin
>
> OR in Windows
>
> % cd <gdal root>\frmts\georaster
> % nmake -f makefile.vc plugin
>
> Copy that plugin to where the GDAL shared library can find it (the   
> subfolder gdalplugins or a folder pointed by GDAL_DRIVER_PATH) and   
> use a GeoRaster object as your raster data source. You can either   
> create a VRT to point to a GeoRaster object or use the GDAL   
> subdataset identification string as your raster data source, e.g.   
> "geor:user/pwd at db,tab,col,where" or "geor:user/pwd at db,rdt,id".
>
> That technique works for MapServer.
>
> Now, going back to the WKT Raster. I have loaded Raster on PostGIS   
> before using TerraLib and I believe there is a very large project   
> called TerraAmazon using that combination. In terms of query and   
> functionality I know that TerraLib also does raster/vector   
> intersection too but I am wondering how the overall raster   
> performance comparison looks like; loading time, query time,   
> limitations, etc.
>
> Great job!
>
> Regards,
>
> Ivan
>
>>  -------Original Message-------
>>  From: christian.mueller at nvoe.at
>>  To: Ivan Lucena <ivan.lucena at pmldnet.com>
>>  Cc: Pierre Racine <Pierre.Racine at sbf.ulaval.ca>,   
>> gdal-dev at lists.osgeo.org <gdal-dev at lists.osgeo.org>
>>  Subject: Re: [gdal-dev] Raster/vector intersections in PostGIS WKT Raster
>>  Sent: Jun 30 '10 05:42
>>
>>  Hi, the documentation for the GeoRaster geotools plugin is here
>>
>>  http://docs.codehaus.org/display/GEOTDOC/Oracle+GeoRaster+Plugin
>>
>>  For geoserver look here
>>
>>  http://docs.geoserver.org/stable/en/user/data/oraclegeoraster.html
>>
>>  Technically , I investigated int the Oralce Java API.   2 problems  
>>  occurred.
>>
>>  1) we cannot redistribute the oracle jar files (license issues). As a  
>>  consequence, the module would have broken the geotools build or I  
>>  would have to code the whole stuff using  the java reflection api.
>>
>>  2)  Even worse, the GeoRaster Java API is not stable, the API for  
>>  10.1, 10.2 and 11.x differ making it necessary to write a plugin  
>>  version for each Oracle version.
>>
>>  At the end, I kept it simple doing the whole stuff using Oracle SQL  
>>  syntax which should be stable.
>>
>>
>>
>>
>>
>>
>>  Quoting Ivan Lucena <ivan.lucena at pmldnet.com>:
>>
>>  > Christian,
>>  >
>>  > How did you added support for Oracle GeoRaster on  
>>  > GeoTools/GeoServer? Did you use the Oracle GeoRaster Java API or  
>>  > GDAL? Is that available?
>>  >
>>  > I am looking forward to use it.
>>  >
>>  > Regards,
>>  >
>>  > Ivan
>>  >
>>  >
>>  >>  -------Original Message-------
>>  >>  From: christian.mueller at nvoe.at
>>  >>  To: Pierre Racine <Pierre.Racine at sbf.ulaval.ca>
>>  >>  Cc: gdal-dev at lists.osgeo.org <gdal-dev at lists.osgeo.org>
>>  >>  Subject: Re: [gdal-dev] Raster/vector intersections in PostGIS  
>>  WKT Raster
>>  >>  Sent: Jun 29 '10 11:46
>>  >>
>>  >>  Hi, superb job. Congratulations.
>>  >>
>>  >>  I am a geotools/geoserver developer and one of my jobs is fetching  
>>  >>  image tiles  or the corresponding pyramid tiles from jdbc data  
>>  >>  sources. Some weeks ago, I added support for Oracle Georaster and I  
>>  >>  want to support WKT Georaster too.
>>  >>
>>  >>  wktraster makes it quite simple to achieve this. Is there any   
>> database  
>>  >>  layout you recommend. (A table for the image and one for each   
>> pyramid,  
>>  >>  or put all the tiles into one table having an attribute "level",.....).
>>  >>
>>  >>  I have seen "gdal2wktraster.py", is this the recommended way   
>> to import  
>>  >>  tiles into postgis ?
>>  >>  What is the table layout created/needed by this utility ?
>>  >>
>>  >>  Cheers
>>  >>  Christian
>>  >>
>>  >>
>>  >>
>>  >>  Quoting Pierre Racine <Pierre.Racine at sbf.ulaval.ca>:
>>  >>
>>  >>  > Hi everybody,
>>  >>  >
>>  >>  > I'm pleased to announce that you can now do intersections between  
>>  >>  > rasters and geometries very much like you used to do  
>>  >>  > geometry/geometry intersections in PostGIS. For this, PostGIS WKT  
>>  >>  > Raster introduces two new functions to PostGIS:  
>>  >>  > ST_Intersects(geometry, raster, band) and ST_Intersection(geometry,  
>>  >>  > raster, band).
>>  >>  >
>>  >>  > As its geometry/geometry sister, ST_Intersects(geometry, raster,  
>>  >>  > band) returns TRUE if the withvalue area of a raster or a raster  
>>  >>  > tile (nodata value are ignored) intersects a geometry and  
>>  >>  > ST_Intersection(geometry, raster, band) returns the geometry/value  
>>  >>  > set of geometries representing the intersection between the   
>> geometry  
>>  >>  >  and each polygonized group of pixel sharing a same value from the  
>>  >>  > raster and its associated value. Example:
>>  >>  >
>>  >>  > SELECT polyid,
>>  >>  >        (ST_Intersection(the_geom, rast)).geom,
>>  >>  >        (ST_Intersection(the_geom, rast)).val
>>  >>  > FROM my_polygons, srtm_tiled
>>  >>  > WHERE ST_Intersects(rast, the_geom)
>>  >>  >
>>  >>  > or, a bit more complex, but much faster and returning the   
>> same result:
>>  >>  >
>>  >>  > SELECT polyid, (gv).geom, (gv).val
>>  >>  > FROM (SELECT polyid, ST_Intersection(the_geom, rast, 1) AS gv
>>  >>  >      FROM my_polygons, srtm_tiled
>>  >>  >      WHERE ST_Intersects(rast, the_geom)) foo
>>  >>  >
>>  >>  > These functions works with any kind of geometry so you can   
>> intersect  
>>  >>  >  any road, river, polygons or point layer with your favorite  
>>  >>  > elevation or land cover raster of any resolution and any size. You  
>>  >>  > can also load any number of raster in the database with one command  
>>  >>  > line to constitute a unique table raster coverage of any shape (no  
>>  >>  > matter if your group of raster do not form a rectangular coverage).
>>  >>  >
>>  >>  > You will find a complete tutorial on how to use those two new  
>>  >>  > functions here:  
>>  >>  > http://trac.osgeo.org/postgis/wiki/WKTRasterTutorial01. A reference  
>>  >>  > is available here:  
>>  >>  >  
>>  >>   
>> http://postgis.refractions.net/documentation/manual-svn/RT_reference.html  
>>  >>  > and chapter 13 of "PostGIS in Action" is also a very good  
>>  >>  > introduction to WKT Raster.
>>  >>  >
>>  >>  > Compilation and installation info are available in the project home  
>>  >>  > page: http://trac.osgeo.org/postgis/wiki/WKTRaster
>>  >>  >
>>  >>  > These features are the result of two years of collaboration between  
>>  >>  > many people and companies interested in bringing raster into  
>>  >>  > PostGIS. I would like to thanks particularly Steve Cumming who  
>>  >>  > initially made all this possible, Sandro Santilli who wrote   
>> the base  
>>  >>  >  code, Mateusz Loskot who wrote the Python loader, Jorge   
>> Arevalo who  
>>  >>  >  wrote the GDAL driver and ST_DumpAsPolygons(), Regina and Leo Obe  
>>  >>  > who are doing so many things and believed in the project from the  
>>  >>  > beginning by adding a chapter about WKT Raster in "PostGIS in  
>>  >>  > Action" and also David Zwarg who wrote most of the setter functions.
>>  >>  >
>>  >>  > This is the first step toward a first complete raster/vector  
>>  >>  > analysis and manipulation SQL API. We hope to make of PostGIS with  
>>  >>  > WKT Raster the most powerful and complete GIS analysis and  
>>  >>  > manipulation high level language ever (!!!). WKT Raster should  
>>  >>  > normally be totally integrated into PostGIS in PostGIS release 2.0.  
>>  >>  > Upcoming functions should include ST_Reclass, ST_Clip, ST_AsRaster,  
>>  >>  > ST_Resample.
>>  >>  >
>>  >>  > Let us know your need and your experience with WKT Raster.
>>  >>  >
>>  >>  > Thanks,
>>  >>  >
>>  >>  > Pierre Racine
>>  >>  >
>>  >>  > _______________________________________________
>>  >>  > gdal-dev mailing list
>>  >>  > gdal-dev at lists.osgeo.org
>>  >>  > http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>  >>  >
>>  >>
>>  >>
>>  >>
>>  >>  ----------------------------------------------------------------
>>  >>  This message was sent using IMP, the Internet Messaging Program.
>>  >>
>>  >>
>>  >>  _______________________________________________
>>  >>  gdal-dev mailing list
>>  >>  gdal-dev at lists.osgeo.org
>>  >>  http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>  >>
>>  >
>>
>>
>>
>>  ----------------------------------------------------------------
>>  This message was sent using IMP, the Internet Messaging Program.
>>
>>
>>
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the gdal-dev mailing list