Last year, I wrote what was intended to be the first of a series of posts about Mapnik – a software toolkit for generating beautiful maps from various sets of spatial data. My intention had been to describe how to render spatial data from SQL Server as styled raster tile layers on Bing Maps, but the series got cut short rather prematurely when I discovered that it didn’t appear to be possible to connect Mapnik to SQL Server (even though it was an OGR-supported format).
Unfortunately, as is often the case with OS software, it seems that almost all Mapnik developers use PostGIS as a backend spatial database, and I failed to find anybody with any experience of SQL Server on either the Mapnik developers mailing list or on StackExchange (rather amusingly, the top-rated answer given to me on StackExchange gives, as its reference source, my own blog post where I explicitly state that the suggested approach doesn’t work!).
Since, at the time, I needed a tool to render SQL geometry data there and then, I left Mapnik alone and developed a solution using MapServer instead.
Now, MapServer is a great product: It’s a venerable and highly-respected product in the world of open source spatial software, developed by the University of Minnesota on behalf of NASA, and first released over 16 years ago (to put that in context: MapServer was released at around the same time as HTML 3.2 – long before CSS, AJAX, or Google Maps were heard of). And it’s still going strong today. However, I find that the archaic MapServer architecture and idiosyncracies of its syntax give away its age slightly.
Mapnik, by contrast, is freshly-designed, has a modern XML-style syntax, supports groovy things like node.js and Ruby, and generally feels like it’s not carrying so much baggage. If only it supported SQL Server….
6 months later, and the Release Candidate for Mapnik 2.0 is now available to download, which claims to support SQL Server, so I thought I’d give it another try. Having just set it up and rendered some quick OS OpenData, I can confirm that it works. Hurray!
SSMS Spatial Results Tab Rendering of SQL Server data
Mapnik Rendering of the same SQL Server data
Since it seems that I’m one of only few people trying to use Mapnik and SQL Server together (and one of even less writing about it), I’ve started to document some tips in a page here – I’ll add to this page as I go along.