Raster in the Database

There’s an interesting question posted on the All Points Blog:

If I want to use image pyramids to speed data distribution at different scales, should I consider storage in a spatial database? Is that how most pyramids are stored? I guess the files can be stored outside a database, but is it as efficient?

The responses are interesting and confirm something I’ve been telling people for a long time – there is no advantage to putting your raster layers in a database. In fact it’s quite the opposite. The amount of drive space you’ll need will increase substantially (unless you like your images extra fuzzy), you will incur big software costs, and your performance will likely be the same or a little worse.

This isn’t what you’ll hear from database vendors, but remember, the vendor exists to vend. Telling you you don’t need something isn’t high on their list of priorities. And don’t listen to the awe and wonderment surrounding the building of pyramids. You can build pyramids for your plain old raster files, and some formats (like Mr. Sid) have pyramids built in whether you want them or not.

I’ve talked to a lot of private sector developers and I’ve done quite a bit of experimenting myself, and the conclusion I’ve reached from both is don’t put your rasters in a database. If you are worried about file share licenses, put your imagery on a linux box, and if you want to serve them over then net via WMS, use something easy like MapServer and then build a tile cache with something like Tilecache. I think even ESRI is coming to this conclusion with their ArcGIS Image Server.

Have a different take on the matter? Sound off in the comments section.

This entry was posted in Code. Bookmark the permalink.

2 Responses to Raster in the Database

  1. Alexandre de Amorim says:

    I agree that there is no advantage to putting raster layers in a database, but only if the raster layers are images. If we have to deal with DEM and other raster layers derived from this, in which we have to obtain cell values in a determined point, I think that we have to put raster layers in a database.

  2. Julia Harrell says:

    Actually, Mapserver will do raster pixel queries, so you can get cell values from an image without having to clog up your database with imagery or DEMs. See http://mapserver.gis.umn.edu/docs/howto/raster_data/#raster-query and http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?RasterQuery. WMS GetFeatureInfo requests also work against raster layers in a WMS served by Mapserver. If your WMS returns GetFeatureInfo responses in GML instead of plain text or HTML, you have set the layer to DUMP TRUE in the mapfile and also set the gml_* metadata for the layer attributes to be served. You also need to set the layer TEMPLATE parameter for the layer to be queryable by GetFeatureInfo requests. For requests of type “text/html” you should also set the layer HEADER and FOOTER parameters.

Leave a Reply

Your email address will not be published.

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>