[postgis-users] How to import/export PostGIS Raster data? Tools?

Jorge Arévalo jorge.arevalo at deimos-space.com
Thu Nov 25 15:59:15 PST 2010


Hello,

On Thu, Nov 25, 2010 at 8:39 PM, Stefan Keller <sfkeller at gmail.com> wrote:
>> Eventually GDAL will have both import and export functionality.  Right now
>> it just has just export functionality. Jorge Arevalo can talk more about...
>
> Thanks a lot to Regina and Jorge! So let me summarize:
>
> A. For importing raster data to PostGIS there's gdal2wktraster.py (now
> renamed to raster2pgsql.py). raster2pgsql takes any GDAL supported
> raster format as input and writes an SQL text file in PostGIS Raster
> WKT syntax - similar how shp2pgsql functions for vector formats.
> Inside raster2pgsql, GDAL functions are called to read/import "any"
> raster format, and the Python code writes PostGIS Raster WKT(!) SQL.
>
> => So in fact, gdal2wktraster.py/raster2pgsql.py does not necessary
> need an installed "GDAL PostGIS Raster driver"?
>

Exactly. Only needs GDAL >= 1.6.0. It will load any GDAL accepted
raster format in db, using new PostGIS Raster format. No GDAL PostGIS
Raster driver needed.


> In later versions of GDAL (> 1.7) there is a direct PostGIS Raster
> writer/export for GDAL where a Postgres DB (WKB!) is the target
> "format".
>

In GDAL 1.8.0SVN, there's an improved version of PostGIS Raster
driver, but still doesn't accept new raster creation. Working on it.


>
> B. For exporting PostGIS raster data to any other raster format, one
> can already use gdal_translate, gdal_warp etc. commandline tools
> (which requires an installed "GDAL PostGIS Raster driver" i.e. a
> reader). And since many other API tools/projects built on top of GDAL,
> these are already capable of using PostGIS raster data (WKB stream) as
> input source - given their GDAL library is compiled with PostGIS
> Raster support.
>

Yes. But still there are no experiences with any sotfware, constructed
over GDAL, using PostGIS Raster GDAL driver to show PostGIS Raster
data. I think Regina had some problems with Mapserver. I'm working on
it too (helping other people with it, actually).


> In the near future, there are plane to also have 1. a raster2pgsql
> (excutable) for direct import into a PostGIS DB and 2. a pgsql2raster
> (executable) for direct export out of a PostGIS DB (without Python
> dependency). => But in both cases I'm not sure what the advantage and
> what the difference of this is compared to a direct call to GDAL tools
> (>1.7), since in PostGIS 2.x, GDAL will be delivered anyway in the
> PostGIS package?
>
> Yours, S.
>

Ok, from my point of view, this is like having shp2pgsql/pgsql2shp and
ogr2ogr. Both tools can be used to import/export data between
PostgreSQL and other vectorial formats (only SHP files, with PostGIS
official loader). And both are free tools.

Anyway, pgsql2shp/shp2pgsl are the official tools from PostGIS
projects. ogr2ogr is a tool from GDAL project, with a more general
purpose. The same point with raster2pgsql/pgsql2raster and
gdal_translate.

Best regards,
Jorge

> 2010/11/25 Paragon Corporation <lr at pcorp.us>:
>> Jorge,
>>> I'd like to take a deeper look on the chapter. My last version is from
>> 11/8/2010. Is it the last one?
>>
>> We have a slightly newer one but not too different from the version you
>> have.  Jan Hartmann made some suggestions we still need to integrate and
>> then we'll send your way.
>>
>> Thanks,
>> Regina and Leo
>>
>>>
>>> Thanks,
>>> Regina and Leo
>>> http://www.postgis.us
>>>
>>>
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users at postgis.refractions.net
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>>
>>
>> Best regards,
>>
>> --
>> Jorge Arévalo
>> Internet & Mobilty Division, DEIMOS
>> jorge.arevalo at deimos-space.com
>> http://mobility.grupodeimos.com/
>> http://gis4free.wordpress.com
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



-- 
Jorge Arévalo
Internet & Mobilty Division, DEIMOS
jorge.arevalo at deimos-space.com
http://mobility.grupodeimos.com/
http://gis4free.wordpress.com



More information about the postgis-users mailing list