PostGIS Raster Home Page

Quick Links
What's new about PostGIS Raster?

August 27, 2012
FME 2013 will soon read and write rasters stored in PostGIS!
Safe Software will write a reader, a writer and some others functionalities to interact with rasters stored in PostGIS! These tools should be released with FME 2013 and already available in future beta versions of FME this fall. A great news for the PostGIS community!

On the GDAL side, lots of improvement have been recently done on the PostGIS Raster driver. You can now read irregular arrangements of raster and translate them into any format supported by GDAL. We are still looking for sponsors to implement the writer part of the driver.

July 24, 2012
PostGIS Raster Released with PostGIS 2.0 and another GSoC!
Lot's of things happened since the last news was published in this page. First of all PostGIS Raster is now part of PostGIS 2.0! Congratulation to everybody who worked (and still work) on the raster stuff: Bborie, Jorge, Regina, David, Mateusz, Sandro & Pierre! Second: A second Google summer of Code project has been accepted for PostGIS (the first was for the GDAL driver and hence for the GDAL project actually). Qing Liu will work on a distance raster to feature function and a cost distance function if she gets time. Welcome Qing!

On Thursday, at 4 PM, Jorge Sanz and Ignacio Brodin will show how to access PostGIS Raster from gvSIG Desktop. On Friday, at 11 AM, Pierre Racine will speak about how to store, manipulate and analyze raster data within the PostgreSQL/PostGIS spatial database (video). He will also present what has been done since last year and what can be done with PostGIS Raster. See you in Denver: September 12-16!

August 1, 2011
Two presentations about PostGIS Raster this year at FOSS4G in Denver!
On Thursday, at 4 PM, Jorge Sanz and Ignacio Brodin will show how to access PostGIS Raster from gvSIG Desktop. On Friday, at 11 AM, Pierre Racine will speak about how to store, manipulate and analyze raster data within the PostgreSQL/PostGIS spatial database (video). He will also present what has been done since last year and what can be done with PostGIS Raster. See you in Denver: September 12-16!

March 24, 2011
A great Code Sprint and... ...a new contributor!
David Zwarg from Azavea and Pierre Racine from the CFR met for the first time at the Montréal Code Sprint last week. They came out with a very innovative MapAlgebra function based on a user defined PL/pgSQL function. This code should be committed soon with another version involving neighbour pixels. On another side, students are already showing interest for our Google Summer of Code Ideas and Bborie Park, an experienced programmer from the Center for Vectorborne Diseases at the University of California will join the team. He will work on a series of SQL function converting PostGIS rasters to the different formats supported by GDAL and on resampling. Welcome Bborie!

February 14, 2011
Two plugins to display PostGIS rasters!
Thanks to Maurício de Paulo, there is now a plugin to display PostGIS rasters in QGIS. Look for "wktraster" in the QGIS plugin page and Mauricio's article (if you can decrypt portuguese!). Samething on the side of gvSIG, the popular spanish open source GIS! Nacho Brodin has developed a plugin to display raster stored in PostGIS. See the page of the project. On our side, we are working fixing bugs and implementing ST_MapAlgebra. See you at the Code Sprint 2011 in Montréal (march 15-18)!

September 15, 2010
WKT Raster becomes THE new PostGIS raster type!
It's official! The WKT Raster extension will become the new PostGIS RASTER type in PostGIS 2.0 planned for next april. The PostGIS and the WKT Raster team met at the FOSS4G friday's code sprint and decided that WKT Raster was mature enough to bring interesting new functionalities to PostGIS. A new MapAlgebra function should be added for this release. Congratulation to the whole team for all the work accomplished!

August 11, 2010
PostGIS WKT Raster at FOSS4G
There should be a lot of discussion about PostGIS WKT Raster at FOSS4G, the most important conference for free and open source software for geomatics, as both Pierre Racine and Jorge Arévalo presentations have been selected by the attendees. Pierre will first introduce the project in a presentation entitled “Introducing PostGIS WKT Raster: Seamless raster/vector operations in a spatial database” and Jorge will present the result of its meticulous study of the difference between PostGIS WKT Raster and Oracle GeoRaster in a presention entitled “PostGIS WKT Raster. An Open Source alternative to Oracle GeoRaster”. You can already read Jorge’s first impression in his first article in a series. CU September 6th 2010 in Barcelona!

June 11, 2010
A tutorial and a book!
The PostGIS in Action chapter on PostGIS WKT Raster is out! Thanks to Regina Obe and Leo Hsu, there is already a good amount of literature on WKT Raster and this makes WKT Raster to be a little bit more in the PostGIS family. Pierre Racine has also written a tutorial on how to import and intersect a huge raster coverage with a vector coverage. Your raster coverage is huge and you can't work with it in your favorite GIS platform? Read the tutorial! You will be amazed by the simplicity and the speed of the intersection functions. Good reading!

February 22, 2010
A third company join the WKT Raster team!
The award-winning GIS software development firm, Azavea, specializing in web-based geographic analysis, visualization and modeling applications, decided to invest in WKT Raster development. The company sent David Zwarg and Jeff Adams to the Code Sprint 2010 in NY. Jeff worked on PostGIS and David helped with many WKT Raster base functions. David committed himself to work on many other WKT Raster functions in the near future. His main task will be to design and implement the ST_MapAlgebra() and the ST_Resample() functions. Welcome David!

December 10, 2009
Tyler Erickson speaks about his need for PostGIS WKT Raster at FOSS4G 2009
Tyler Erickson, Research Scientist at the Michigan Tech Research Institute presented his research project at FOSS4G 2009 in Sydney, Australia. Tyler uses GeoDjango and PostGIS to visualise the results of CO2 simulation models directly in Google Earth. WKT Raster would enable him to easily do raster/vecter spatial analysis from his web application. Tyler's project was selected as one of the professional winners in Google’s 2009 KML in Research Competition.

December 4, 2009
Jorge Arevalo full time on WKT Raster!
Jorge Arevalo who developped the first version of the GDAL WKT Raster driver during the summer of 2009 will be working for at least one year on WKT Raster. Jorge is working for DEIMOS Space, a Spanish aerospace company leading the Espana virtual project. Jorge's superior, Miguel Lizondo, confirmed that Jorge would be devoting most of his time to WKT Raster in the coming year. This commitment should normally be extended for a second year afterward.

Jorge will follow the planned roadmap and will be the main developper for the coming year. Mateuzs Loskot will continue contribute his spare time to the project and Pierre Racine will help Jorge with the specifications and the general management of the project.

Welcome (back) Jorge!

October 16, 2009
PostGIS WKT Raster at Geomatique 2009 in Montréal!
Pierre Racine will present WKT Raster at Geomatique 2009 in Montréal on October 20. We hope we can get more people interested by the project! See the presentation (PDF)!

June 04, 2009
A prototype GDAL driver to WKT Raster implemented this summer!
Thanks to Mateusz Loskot, who proposed the Google Summer of Code project and Jorge Arevalo the student who was selected to implement it.

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.

Installation

  • 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.

Documentation

Development Info

  • Planning - For a detailed schedule of PostGIS works and to know how to contribute.

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().
  • 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.

More Info

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.

Overview of Planned PostGIS Raster Features

PostGIS Raster...

...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
  • etc...)

...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
  • etc...

...and seamless geometry operators...

  • ST_Intersects(raster|geometry, raster|geometry) -> boolean
  • ST_Contains(raster|geometry A, raster|geometry B) -> boolean
  • etc...

...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

 Regina Obe (coauthor of  PostGIS in Action):

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

Open Tickets

#828
[raster] Loader generates wrong SQL when NODATA for a band is NaN
#1002
[raster] Add geometry filtered variations for various statistics functions
#1048
[raster] Coverage version of stats functions should be aggregates
#1058
[raster] Two-raster spatial operations framework proposal
#1092
[raster] Ability to autogenerate images for postgis documentation using raster
#1138
[raster] Add an option to raster2pgsql to change the pixeltype when loading
#1168
[raster] ST_AsRaster ability to render more complex types
#1193
[raster] Add the possibility to aggregate values when rescaling with ST_Rescale()
#1267
[raster] Add manual height/width support to ST_Resample
#1379
[raster] raster2pgsql: load a raster as a band(s) of an existing raster
#1422
[raster] Issues with Mapserver and GDAL
#1554
[raster] ST_SetRotation does not preserve the angle between basis vectors
#1582
[raster] Rewrite ST_CreateIndexRaster as a wrapper around ST_MapAlgebraExpr
#1583
[raster] Optimize ST_Intersection(raster, geometry) with ST_Clip()
#1648
[raster] ST_AsRaster unexpected result
#1662
[raster] Make a ST_Extent(raster) aggregate taking rotation into account
#1748
[raster] st_intersection function names in docs don't match with what's installed
#1764
[raster] overviews not marked as same alignment though main table is
#1858
[raster] Raster dataset functionality
#2058
[raster] Add a ST_SetValues variant copying values from another raster band
#2111
[raster] External band numbers are capped to 1 - 256
#2113
[raster] Add flag to select resampling algorithm for creating overviews from source rasters
#2116
[raster] ST_Value(rast, point) should have an option for when the geometry is at the edge of a pixel.
#2127
[raster] raster2pgsql support for projection
#2133
[raster] possible performance issue with ST_MapAlgebra
#2136
[raster] ST_AsGDALRaster ability to take set of rasters
#2137
[raster] Add handling for overviews present in source rasters
#2189
[raster] Ability to import EXIF data as part of raster2pgsql load
#2203
[raster]: Can't read out_db jpg in some cases
#2221
[raster] ST_RastFromWKB
#2247
[raster] Create ST_CreateOverviews()
#2249
[raster] Implement ST_MakeEmptyCoverage
#2263
[raster] Audit usage of serialize/deserialize vs wkb/hexwkb
#2281
multiband raster burning (braindump)
#2299
revise raster garden test to handle new types
#2310
[raster] st_wedge
#2311
[raster] st_annulus
#2312
[raster] st_circle
#2325
[raster]: ST_SetBandNoDataValue support setting multiple bands
#2327
[raster] ST_Drape
#2353
[raster] GDAL's GDALFPolygonize() function
#2373
[raster] Performance test suite
#2386
[raster] raster2pgsql misses man page
#2442
[raster] Segfault when doing raster2pgsql
#2474
[raster]: ST_Union that takes 2 rasters
#2485
[raster]: raster constraints prevent raster data from restoring
#2526
[raster] Dynamic Background Workers
#2566
[raster] ST_ValueCountAgg()
#2586
[raster] ST_Clip with geometry smaller than pixel size
#2596
[raster] St_isVisible
#2597
[raster] St_Grayscale
#2598
[raster] ST_Blur
#2599
[raster] ST_Sharpen
#2600
[raster] ST_EdgeDetect
#2601
[raster] ST_Convolution
#2603
[raster] Add docs for ST_MapAlgebra with mask parameter
#2617
[raster] Enhanced mask object for raster map algebra
#2629
[raster] Masks as POI lists
#2657
[raster] Respect imprecise real valued nodata
#2667
Put in availability comment for raster operators and types
#2728
[raster] ST_Values (plural form of ST_Value)
#2743
[raster]: postgis.gdal_datapath not working (windows 9.4 64-bit)
#2798
raster2pgsql spins CPU on statement timeout
#2800
[raster] Coverage topology broken by ST_Rescale
#2804
[raster] ST_MapAlgebra support for user callbacks without userarg parameter
#2807
[raster] ST_MapAlgebra injecting a default NODATA value of 0
#2809
[raster] AddRasterConstraint does not check arguments upfront
#2823
[raster] upgrade drops privileges on the raster_columns view
#2832
[raster] raster2pgsql pads overviews with single tiles
#2842
[raster] Hide unselectable tables from raster_overview and raster_columns
#2843
[raster] Support reprojection on import
#2889
[raster]: warning rt_pg_error suggestion by compiler to use gnu_printf
#2894
Kernel density estimation with PostGIS raster
#2901
raster trying to use strange SRID
#2905
Ensure that raster_columns is always readable by public unless explicitly made unreadable
#2911
ST_Rescale changes extent

Attachments