I'm looking to store a huge raster aerial image (400 Gb) into Postgis, but before storing it i like to know how i could georeference or rectify raster stored in postgis ? is there any Qgis plugins like georeferencer, but could read in-database-raster or any other software ? any hints ?

  • 1
    In order to deal with huge dataset, i would avoid using QGIS. Have you got access to the gdal library? – julsbreakdown May 20 '15 at 12:29
  • 1
    I don't think you can georeference within Postgis. Raster's are assumed to be georeferenced before loading. You can transform rasters once they are in. – John Powell May 20 '15 at 12:31

For that kind of dataset I would argue that would be un-wise and try to reproject-on-the-fly.

It can be done with ST_Transform(rast), but if you want to go that road be sure to include spatial extents (rast type can be casted to geom type).

As aerial images are mostly for viewing I would suggest to consider using an intermediate step by using a TileService service to deliver your image.

You can configure the WMTS' gridset to be in whatever CRS you want it to be.

If you want that solution the general workflow would be like this:

POSTGIS RASTER -> WMS Service -> TMS Service -> Client

  • i share your point of view but for my needs, i have to share not yet finished raster which could be rectified later (with more control points), i'm not needing a transformation of the raster. – geogeek May 20 '15 at 12:44
  • 1
    georectification needs auxiliary datas (like DTMs). Updating the GCP's will require to remake the output, to take into account that the aux data were moved with the new solution. In this kind of context I think its a matter of software limitation if it can read/write from/to a postgis or not. – nickves May 20 '15 at 13:00

It depends what you mean with georeferencing. There actually is the ST_Georeference function which doesn't change the raster itself, it simply defines where the raster is located in space by setting 6 offset/scale/skew coefficients. As mentioned by @JohnBarça, your raster should have the proper georeferencing metadata, but sometimes it doesnt, and that is when you have to define it yourself.

This is different from the ST_Transform which is more like reprojecting and actually changing the data values.

Note however, given the size of your raster I assume your raster is tiled (ie chopped up into several tiles/subrasters, where each row in your database table represents one of these tiles). ST_Georeference like all other PostGIS functions work on each individual row/tile (not on your entire raster as a whole), so you will have to think it through thoroughly to give the correct georeferencing to each tile.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.