PostGIS Raster Home Page
Welcome to the PostGIS Raster project home page!
PostGIS Raster is an ongoing project aiming at developing raster support in PostGIS. It is a new project very different from the previous PGRaster project and also very different from Oracle Spatial GeoRaster.
The goal of PostGIS Raster is to implement the RASTER type as much as possible like the GEOMETRY type is implemented in PostGIS and to offer a single set of overlay SQL functions (like ST_Intersects) operating seamlessly on vector and raster coverages.
PostGIS Raster is now part of PostGIS starting with version 2.0 (spring 2012)!
PostGIS Raster Google Summer of Code 2012 Ideas
This year again every projects submitted by OSGeo to the Google Summer of Code will be financed by Google. This means 5000 USD$ for a programming student summer job! See our project list or propose your own one! Every details here and here. Deadline to apply: April 8.
- Linux - Different repositories exist for binary versions of PostGIS. If no repository is available for your Linux flavor, you will have to compile PostGIS yourself.
- Windows Binaries - If you are running PostGIS on Windows, you can find fairly recent binaries of PostGIS 2.0 (including raster support) in the Windows Experimental Builds section. These are for PostgreSQL 8.4, 9.0, and upcoming 9.1. Note that development on the standalone wktraster project deployable on PostGIS 1.3-1.5 has stopped and all future versions and bug fixes of raster support will be packaged in the PostGIS 2.0 builds. The last set of binaries for the wktraster stand-alone are also available on Windows experimental page for PostgreSQL 8.3,8.4,9.0 running for PostGIS 1.4-1.5.
- Mac OSX Binaries - If you are running PostGIS on Mac OSX leopard or Snow Leopard, you can find fairly recent binaries of PostGIS at KyngChaos PostgreSQL GIS.
- GDAL PostGIS Raster Driver - A GDAL PostGIS raster driver was developed following a Google Summer of Code 2009 grant obtained by Jorge Arevalo.
- How to install and configure PostGIS Raster on Windows
- Intersecting vector polygons with large raster coverage using PostGIS WKT Raster
- Jorge has a whole series on PostGIS Raster and comparing activities you do in Oracle GeoRaster vs. how you would do them with PostGIS Raster. Check out Jorge's PostGIS Raster Tutorial Series.
- Store, manipulate and analyze raster data within the PostgreSQL/PostGIS spatial database - FOSS4G 2011, Denver, USA, September 2011. (PDF)
- PostGIS 2.0 Raster and 3D Support Enhancements North Carolina GIS Conference 2011 (NCGIS 2011) (PDF)
- Introducing PostGIS WKT Raster: Seamless Raster/Vector Operations in a Spatial Database - FOSS4G 2010, Barcelona, Spain, September 2010. (PDF)
- PostGIS WKT Raster. An Open Source alternative to Oracle GeoRaster - FOSS4G 2010, Barcelona, Spain, September 2010. (PDF
- Introduction to WKT Raster - Geomatique 2009, Montréal, October 2009. (PDF)
- Original Project Presentation - rationale, examples and preliminary specifications (PDF)
- Planning - For a detailed schedule of PostGIS works and to know how to contribute.
- Working Specifications - To know more about or contribute your ideas about the design of PostGIS Raster.
- Source Code, API and Bug report
- PostGIS Raster source code is packed with PostGIS source code, available from the OSGeo Subversion repository
svn checkout https://svn.osgeo.org/postgis/trunk postgis-svn
- You can also download the latest development snapshot from: http://postgis.net/download/
- Compilation instructions are availables in the Documentation.
- Doxygen API reference is available on PostGIS Current Reference, Old WKTRaster standalone pages.
- See report with All tickets reported to PostGIS Raster
- PostGIS Raster source code is packed with PostGIS source code, available from the OSGeo Subversion repository
Displaying PostGIS rasters
There are some options to display rasters stored in PostGIS.
- OpenJump - OpenJump will not display raster directly but a vectorization of the raster. Use a query like the following in the "Layer→Execute Query" dialog:
SELECT ST_AsBinary((ST_DumpAsPolygons(rast)).geom), (ST_DumpAsPolygons(rast)).val FROM rastertable
- ArcGIS 10 - Same idea as with OpenJump: You can not display rasters directly but a vectorization of them. See What is a query layer? in the ArcGIS 10 documentation. With ArcGIS you don't have to convert the geometries to WKB with ST_AsBinary().
- QGIS - There is now a plugin for QGIS to display PostGIS rasters. See the original thread, Mapeando o Brasil, the QGIS plugin page and the related paper. For more info on the status of the plugin, contact Maurício de Paulo (mauricio.dev@…).
- gvSIG - There is also a plugin for gvSIG, the popular spanish open source GIS. See the presentation, the documentation and the project page. The plugin should be integrated into gvSIG 2.0. For more info on the status of the plugin, contact Nacho Brodin (ibrodin@…) at Prodevelop. See the plugin in action: OGM
- MapServer - Some test were done to display PostGIS rasters with MapServer… and it works! See this post. More details in chapter 13 of PostGIS in Action.
For more details and examples of application using PostGIS Raster:
- PostGIS Raster has been designed following a thorough analysis of the numerous discussions about raster integration in PostGIS over the recent years. You can find most of the post to the PostGIS-users group related to raster integration in this page.
- Write to Pierre Racine
Overview of Planned PostGIS Raster Features
…is as simple as PostGIS…
- one table = one raster coverage (like a vector coverage)
- one row = one tile or one raster object (like a vector coverage where one row = one geometry)
- only one new type: RASTER (like the PostGIS GEOMETRY type)
- each raster tile has a pixel size, a width and a height, a variable number of band, a pixel type per band and a nodata value per band. Everything essential to do base raster GIS operations.
…is fully integrated into PostGIS…
- since PostGIS version 2.0…
…has an import/export mechanism similar to shp2pgsql
- raster2pgsql allows import of a single raster or a batch of raster into a table representing a tiled coverage.
- a future pgsql2raster should allow export of raster to filesystem rasters.
- a read GDAL driver allow export of rasters from the DB to the filesystem.
…allows easy conversion from/to geometry/raster…
- ST_DumpAsPolygons(raster) → geometry-value set
- ST_AsRaster(geometry, pixelsize) → raster
…implements base GIS raster operations available in most GIS…
- ST_Resample(raster, pixelsize, method) → raster
- ST_Clip(raster, geometry) → raster
- ST_Reclass(raster, string) → raster
- ST_MapAlgebra(raster, raster, mathematical expression) → raster
…introduces raster/geometry seamless spatial operation…
- so you don't have to bother whether the layers are in raster or vector form when using analysis functions.
- ST_Intersection(raster|geometry, raster|geometry) → raster/geometry-value set
- ST_Union(raster, raster) → raster
- ST_Transform(raster, SRID) → raster
…and seamless geometry operators…
- ST_Intersects(raster|geometry, raster|geometry) → boolean
- ST_Contains(raster|geometry A, raster|geometry B) → boolean
…allows raster storage INSIDE the database (as WKB)…
- for efficient overlay analysis operations between vector and raster layers…
…or OUTSIDE the database (as JPEG or TIFF)…
- so desktop and web applications can quickly access and load raster tiles and nevertheless benefits from the powerful PostGIS GiST spatial index. Every PostGIS Raster SQL functions working with in-db raster tiles work seamlessly with out-db raster tiles.
…introduces the concept of raster objects…
- geographic features are stored as variable size raster tiles instead of polygons.
- allows vector to raster conversion without lost of information.
…is much more simple than PGRaster and Oracle GeoRaster! PostGIS Raster supports…
- only one type (instead of two in Oracle Spatial: SDO_GEORASTER & SDO_RASTER). In PostGIS Raster there are no differences between rasters and tiles: a tile is a raster and a raster is a tile. i.e. one row = one tile = one raster; one table = one raster coverage.
- no metadata (like PostGIS)
- no masks (you can create a mask as a band)
- no multiple dimensions (only two: x, y). Not to be confused with bands; PostGIS Raster DO supports multiband raster…
- no pyramids (reduced resolution coverages can be stored as a separate layer)
What do people think about PostGIS Raster?
Paul Ramsey (founder of PostGIS):
This proposal is better than any I have seen, addresses solving problems that if solved will provide actual new functionality and benefit to users, and clearly you've thought this through over some time
The functions PostGIS raster proposes look pretty cool actually and my vision of the benefits of storing raster in the database are covered in it
- [raster] Loader generates wrong SQL when NODATA for a band is NaN
- [raster] Add geometry filtered variations for various statistics functions
- [raster] Coverage version of stats functions should be aggregates
- [raster] Two-raster spatial operations framework proposal
- [raster] Ability to autogenerate images for postgis documentation using raster
- [raster] Add an option to raster2pgsql to change the pixeltype when loading
- [raster] ST_AsRaster ability to render more complex types
- [raster] Add the possibility to aggregate values when rescaling with ST_Rescale()
- [raster] Add manual height/width support to ST_Resample
- [raster] raster2pgsql: load a raster as a band(s) of an existing raster
- [raster] ST_SetRotation does not preserve the angle between basis vectors
- [raster] Rewrite ST_CreateIndexRaster as a wrapper around ST_MapAlgebraExpr
- [raster] Optimize ST_Intersection(raster, geometry) with ST_Clip()
- [raster] ST_AsRaster unexpected result
- [raster] Make a ST_Extent(raster) aggregate taking rotation into account
- [raster] overviews not marked as same alignment though main table is
- [raster] Raster dataset functionality
- [raster] Add a ST_SetValues variant copying values from another raster band
- [raster] External band numbers are capped to 1 - 256
- [raster] Add flag to select resampling algorithm for creating overviews from source rasters
- [raster] ST_Value(rast, point) should have an option for when the geometry is at the edge of a pixel.
- [raster] raster2pgsql support for projection
- [raster] possible performance issue with ST_MapAlgebra
- [raster] ST_AsGDALRaster ability to take set of rasters
- [raster] Add handling for overviews present in source rasters
- [raster] Ability to import EXIF data as part of raster2pgsql load
- multiband raster burning (braindump)
- revise raster garden test to handle new types
- [raster] st_wedge
- [raster] st_annulus
- [raster] st_circle
- [raster]: ST_SetBandNoDataValue support setting multiple bands
- [raster] GDAL's GDALFPolygonize() function
- [raster] Performance test suite
- [raster] raster2pgsql misses man page
- [raster]: ST_Union that takes 2 rasters
- [raster] Dynamic Background Workers
- [raster] ST_ValueCountAgg()
- [raster] ST_Clip with geometry smaller than pixel size
- [raster] St_isVisible
- [raster] ST_Blur
- [raster] ST_Sharpen
- [raster] ST_EdgeDetect
- [raster] ST_Convolution
- [raster] Enhanced mask object for raster map algebra
- [raster] Masks as POI lists
- [raster] ST_Values (plural form of ST_Value)
- [raster] Make test_util_gdal_open standalone (drop requirement of internet access)
- raster2pgsql spins CPU on statement timeout
- [raster] Coverage topology broken by ST_Rescale
- [raster] ST_MapAlgebra support for user callbacks without userarg parameter
- [raster] ST_MapAlgebra injecting a default NODATA value of 0
- [raster] Raster import fails if "raster_columns" is not readable by the user
- [raster] upgrade drops privileges on the raster_columns view
- [raster] raster2pgsql pads overviews with single tiles
- [raster] Support reprojection on import
- Kernel density estimation with PostGIS raster
- [raster] ST_Rescale: Could not create GDAL transformation object for output dataset creation
- Include GDAL error message in raster failure messages
- [raster] bogus handling of identity matrix by _st_gdalwarp
- [raster] raster2pgqsql option for defining a grouping ID (like filename but integer)
- [raster] raster2pgsql should have an option to align tiles
- [raster] Explore usage of GDAL's RasterIO improvements for resampling
- Support for binary input/output for raster
- Another GUC for PROJSO or can we just figure out the PROJSO?
- ST_MapAlgebra with mask seems to hard-code distance 1 instead of inferring distance from mask matrix
- Parallelization of PostGIS raster ST_Union aggregate
- raster2pgsql correctly support the -s from_srid:to_srid
- [raster] ST_DumpAsPolygons() stop differenciate values when they are higher than 1048576
- ST_Clip with multiple geometries
- PG12: Optimize FunctionCall parameter size in rtpg_mapalgebra.c
- [raster2pgsql] -I option recreates index for each insertion
- raster2pgsql debug methods needed, GEOTIFF stalling for hours on addrasterconstraints
- PostGIS raster ST_Intersects regression with pg12
- [raster] ST_SameAlignment() gives differing results based on which argument comes first
- add --long-options to raster2pgsql
- raster2pgsql option to create or append
- Rewrite all raster callback functions in C
- no data check in raster2pgsql and also ST_BandIsNoData are slow
- ST_MakeEmptyCoverage creates a bad tiling
- raster2pgsql should support spatial reprojection
- ST_Union(rast, uniontype) treat bands with different classes as the same as first band
- ST_MapAlgebra not respecting NULL nodatavalues
- ST_Clip(raster, geom) Docs does not says how the pixels are selected
- ST_Clip(raster, geom) include new method to pixel selection: touch
- ERROR: function st_approxquantile(raster, double precision) is not unique
- WKTRasterIntro-Geomatique2009.pdf (1.1 MB ) - added by 14 years ago.
- FOSS4G2010_Pierre.pdf (951.6 KB ) - added by 13 years ago.
- FOSS4G2010_Jorge.pdf (4.2 MB ) - added by 13 years ago.
) - added by 13 years ago.
Video of PostGIS Raster gvSIG plugin.
- PierreRacine_FOSS4G-2011.pdf (2.3 MB ) - added by 12 years ago.