One of the things I'm most excited about in upcoming PostGIS 2.0 are the raster output functions, largely created by Bborie Park. The latest one he added ST_AsRaster should be a welcome addition to even those who don't care about raster because it allows you to convert regular PostGIS geometries to PostGIS raster and then use all the available export functions to output to your favorite image format without ever leaving the database. If you want to try out PostGIS 2.0 and are on windows, you can download compiled versions for PostgreSQL 8.4-9.1 at: http://postgis.net/windows_downloads#PostGIS_2_0_0

This means that PostGIS is now both a spatial as well as a graphical database engine. To test out how I would take advantage of these new features, I decided to create a mini ASP.NET 2.0+ app that is a PostGIS ad-hoc query viewer for both PostGIS geometry and raster. We have it written in both VB.NET and C# and are planning to follow up very soon with a PHP version. We'll also be putting up an online version and tutorial for people to play with who don't have PostGIS 2.0 installed so they can see what they are missing out on :). You can also download the source code from: http://www.postgis.us/downloads/postgis_webviewer_aspnet.zip

We'll be attending FOSS4G2011 in Denver this year, giving a tour of all the new treats in PostGIS 2.0 which will include this as well as PostGIS geometry analysis and maintenance functions/changes, 3D support types and functions, Topology, and Tiger Geocoder. If you are attending, please attend our talk on Friday PostGIS 2.0, the new stuff.

The Application Makeup

The application is very simplistic and is composed of 3 parts:

JQuery for the html page UI which handles all the Ajax calls and DOM changes. JQuery is pretty slick and the more I use it, the more I love it. If you do web development, you should really give it a try.

A stored function just so if I need to do more complex things like, intrusion detection,or benchmarking etc its compartmentalized.

A server-side web handler that passes off the query to the stored function which returns back the query as a PNG file.

Check out these snapshots

I'm hoping in the very near term future to combine this with my favorite .NET reporting engine -- ActiveReports.NET which I currently use for my PostGIS based web apps and which can take database fields consisting of blobs of images. Being able to auto generate an image from spatial data to go in a report will be slick beyond imagination.