A few days ago I started playing with Polymaps and TileStache, two very promising WebGIS building tools.
The final goal of this experiments was the integration with Django.
Polymaps
Polymaps is a Javascript library aimed to display svg maps in a web page, recently I’ve watched to an interesting talk about a Django-powered app built on top of Polymaps:
Erik Dahlström
Interesting choice by Polymaps about the polygons and linestrings, I’d assume it’s to make it easier to do calculations on the data. SVG has a polygon element which could have been used to distinguish the two. However, should you wish my guess is that its’s pretty simple to add a class to the elements that you want to reach quickly with stylerules. That should be more efficient than using the ‘.layer path:not([d$=”Z”])’ rule.
Michal Migurski
Great article, and thanks for the patch to Tilestache! I’ve merged it in, and will push it out with the next release.
Alessandro Pasotti
@Erik
thanks for your comments, I myself was wondering why they’are not using the full set of geometric SVG elements (Polygon, Line etc.) instead of only Path and Circle.
About adding a class, the root of all my problems is that I’m using a GEOMETRYCOLLECTION type in my PostGIS DB. This triggers a lot of problems, to say one: Django OSM admin doesn’t support collections and OpenLayers has a longstanding bug in WKT format reader/writer, but I’ll write more on these topics in another post.
BTW I tried to add a class using a stylist (http://polymaps.org/docs/stylist.html) bound to the “load” or “show” event. Unfortunately this approach revealed to be problematic because the stylist receives a GeometryCollection object and not the individual components, there is a bug in the library that removes child elements in the SVG element, removing child geometries in case of collections.
I’m still trying to debug that messy library, Polymaps source code is a good example of how Javascript code can be similar to old good i386 assembly
Alessandro Pasotti
@Michal
Thanks for the pull, it’s nice to know that TileStache is open to contributions (also when they’re so tiny
)
I’ve also forked and pulled a request to Polymaps, it (hopefully) fixes the bug in Stylist.title when dealing with geometry collections, let’s see if they also accept patches.
Paolo Corti
Alessandro, this is definitely very interesting post
Alessandro Pasotti
@Paolo
thanks Paolo, I’m happy to see how our “virtual life path” crosses again!