[postgis-users] Raster suggestions?
nicky666 at gmail.com
Sat Mar 8 07:07:35 PST 2008
> We are working on modern topographic maps for the entire west coast (about
> 20,000 7.5 minute quadrangles).
> I am currently designing a strategy for serving our products online.
> I plan to use PostGIS for the lines and text (that is a no-brainer), but I
> am not sure what would be the best strategy for handling raster imagery.
> Eventually we will have over 10 TB of raster imagery.
> I have searched the archives, and it looks like that I would use a 'chip'
> table and the PGCHIP project looks pretty interesting. However, I was not
> able to find a consensus on the best way to handle raster data. Some seem to
> suggest geotiff tiles and others suggest a 'chip' solution.
> Can anyone offer me advice? I am on a shoestring startup budget, so the
> simpler and more effective the solution, the better for me. I am completely
> new to PostGIS, so please go easy on me! Any example solutions would be
> greatly appreciated.
> Thanks for your support!
How do you plan to serve your data ? A map engine (perhaps MapServer)
and a web application ?
Do you actually need to store rasters into the database ?
If you only need to display them or serve them through webservices,
you could georefence them in postgis, storing their spatial extension
and file name, but not the actual image data (and some other
information you might find useful, like image dimension, date, image
category, resolution, etc) into a 'raster' table, then use your map
engine configuration to integrate this information into your
We often do the following when serving rasters in a web application:
1. Create a raster table to hold filename, image's bbox, image's date, etc.
2. Populate this table with a python script using gdal/ogr to generate
images' information (bbox, size, date, description, etc)
3. Eventually create views on this table to create logical groups of rasters
4. In MapServer, define one or several layers referencing these views
and use these layers as tileindex in RASTER layers. MapServer will
then use postgis views the same way it uses shapefile tileindex.
You can then query all your geo data (vector and raster) using postgis
You can also easily create new views/mapserver layers on the raster table.
You don't have to deal with TB of storage inside PostGIS.
PS. I can provide you with a simple python script that scans some
directories to find images and generates SQL queries to insert into a
raster table defined as follow:
CREATE TABLE rasters
id SERIAL not null,
path VARCHAR(255) not null,
width INTEGER not null,
height INTEGER not null,
format INTEGER not null,
bbox GEOMETRY not null,
CONSTRAINT rasters_idx primary key(id),
CONSTRAINT format_idx foreign key(format) references raster_formats(id)
(We use a SRID column to be able to store rasters in several
projections in the same table, rasters with same SRID are grouped
together in created views. I'm not sure it's the smartest solution).
More information about the postgis-users