## Google Summer of Code PostGIS Raster Ideas

1) Implement write support for the PostGIS raster GDAL driver.

Mentor: Jorge Arevalo (jorgearevalo at libregis.org) or David Zwarg.

A  GDAL driver allows reading/writing of raster (or images) data from/to formats like TIFF, PNG or JPEG.

The current GDAL PostGIS raster driver supports reading of PostGIS rasters objects from a PostgreSQL/PostGIS database but does not support writing. The project includes proposing a driver writer design and implementing it. You will familiarize yourself with GDAL-OGR development (one of the most used open source geospatial package), geospatial imagery concepts, open source development tools and code in C.

Might be able to reuse some logic already present in the packaged PostGIS raster2pgsql loader.

2) An optimized version of the two rasters ST_MapAlgebra SQL function -- Bborie has already done this.

Mentor: Pierre Racine (pierre.racine at sbf.ulaval.ca)

Map algebra allows the creation of a new raster as a mathematical (or logical) function of one or two other rasters. e.g. raster3 = (raster1 + raster2) / 2. This is a very common raster operation in the GIS world.

A  two rasters version of the ST_MapAlgebra SQL function already exist. It allows a PostGIS user to create a new raster coverage as a function of two existing one with a simple SQL query. e.g.: SELECT ST_MapAlgebra(rast1, rast2, "(rast1 + rast2) / 2") FROM coverage1, coverage2 WHERE ST_Intersects(rast1, rast2). The extent of the resulting raster can be equivalent to the extent of the FIRST, the SECOND, the INTERSECTION or the UNION of both raster.

The current implementation compute the new raster one pixel at a time. It is possible, but complicated, to optimize the algorythm in order to fill many areas as a chunck of data instead of pixels by pixels. The project includes reviewing the proposed algorythm and implementing it. You will familiarize yourself with PostGIS development (the most used open source geospatial database), geospatial imagery concepts, open source development tools and code in C and PL/pgSQL.

3) Implement a set of geometry to raster functions

Mentor: Pierre Racine (pierre.racine at sbf.ulaval.ca)

With the ability to store geometries and rasters in postgis, there is now a gap to fill by implementing geometry to raster algorithms to allow transition from one type to the other.

1) ST_Interpolate should be an aggregate taking a set of points (e.g. filtered lidar points) or line geometries (e.g. digitized topo lines) and their associated values and returning a raster representing a surface interpolated from those values. There are numerous methods of  interpolation and it would nice to have a generic method so we can use all of them, but we’re first targeting  bilinear interpolation, which will fill most needs and lay the ground for other methods. For reference, you might want to check an implementation in  Numerical Recipes (chap. 3) or in  CGAL. Converting a point table to a TIN and then to a raster is also a way to go. A Delaunay triangulation can be produced with the  Triangle library (copyright issues should be checked first). See also  here and  here.

2) ST_AsDensity takes a point or line geometry coverage and first assign a count of those features to every pixels of a raster coverage and then apply a smoothing filter (using the existing one raster version of neighbour ST_MapAlgebra).  Density functions allow summarizing or simplifying a point or line dataset.

3) ST_Distance takes a point or a geometry coverage and compute a raster representing the distance to the nearest geometry. Another function ST_CostDistance() compute the smallest distance to the geometry following a cost raster. This project was proposed by Qing Liu and accepted by the GSoC program.

Want more details? Check the  OSGeo GSoC 2013 page or write to the  PostGIS developer list.