[postgis-users] Storing image file metadata in PostGIS

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Mon May 7 07:49:54 PDT 2012


Billy,

The raster2pgsql loader has a -R option to load rasters as out-db file. In this case a RASTER column is created storing only the bounding box of the raster and the location of the file in the file system.

You can then use most of the PostGIS raster function to extract metadata or interact with geometries (like ST_Intersecst(rast, geom)). ST_BandPath(rast) will get you the path to the raster file.

I think most functions accessing the pixel value now works seamlessly but they should be slower than if the complete raster (with pixel values) would be stored in the DB.

Pierre

> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-
> bounces at postgis.refractions.net] On Behalf Of Billy Newman
> Sent: Saturday, May 05, 2012 4:32 PM
> To: postgis-users at postgis.refractions.net
> Subject: [postgis-users] Storing image file metadata in PostGIS
> 
> Hello all,
> 
> I am currently using a pain old Oracle (not Oracle Spatial) database to store
> metadata for a huge amount of imagery data.  I store this metadata for file
> discovery purposes.  I.E. when a request is made for imagery I can quickly hit the
> DB to get all overlapping image files.  I can then grab those off the file system
> and serve them out.
> 
> I am using imageio-ext (Java) that sits on top of gdal to pull the imagery's
> metadata.  Then just sending that to the DB.
> 
> I am probably doing this the hard way and wondering if PostGIS can help simplify
> things.
> 
> I am wondering if PostGIS has support to store metadata for images, and what
> that support really gives me.  Currently I am serving out images in only
> EPSG:4326 so I want to do any transformations (if the image is not in EPSG:4326)
> to the metadata before storing it in the database.
> 
> Can PostGIS read an image file and extract the metadata, transform the
> metadata into an EPSG:4326 lat/lon bounding box and store it?
> 
> This is my current data model in Oracle if that helps:
> 
> DataSource (this contains general info about this group of image files)
> 
> ImageFile ( each data source has 0 - N image files)
> double minLat
> double maxLat
> double minLon
> double maxLon
> 
> Its as simple as that.  Although I am doing quite a bit of work using imageio-ext,
> and gdal to try and extract, transform, and store the metadata.  Is this less
> complex in PostGIS or essentially the same?
> 
> Thanks!
> Billy




More information about the postgis-users mailing list