GeoJSON tiles working!

Yesterday and today I built a working GeoJSON tiler using node.js, connect, polymaps.js, postgis, and some elbow grease. It is up and running on my development server, and I will be pushing up the building blocks to github when I clean them up a little bit.

One thing that was completely stumping me was that I was trying to use polymaps together with a jsonp service. For some reason I don’t yet understand, that did not work. Admittedly, my jsonp connection was a hack using the jQuery ajax call. It worked for most of the tiles, but consistently certain tiles on the map refused to display, even though I was certain those tiles had valid GeoJSON information in them. With the exact same code and servers, but served from the same domain, the tiles loaded great. I guess I will have to dig into the alternative to jsonp that the polymaps documentation recommends.

My current working implementation lives at It may not live there for very long, as I need that server for other things. It only contains highway data for California, data that we pulled from OpenStreetMap data and massaged into lines. It only has California as our lab is California Traffic Management Labs, not World or US traffic management labs!

All in all, I’m pretty happy with how tiling on the fly works, and with how modern browsers and computers can handle lots of json data to render and manipulate in a slippy map. Not too long ago similar quantities of data would have thrown off one of those “a script on the page is taking too long …” type of errors.


4 thoughts on “GeoJSON tiles working!

  1. Looks awesome – I’d be very interested to know once you have this on a stable server as I would love to do a mashup with Tile5. I haven’t yet implemented the GeoJSON tiling as per polymaps but it’s on the to do list.


  2. Very nice! I keep meaning to try polymaps but I don’t think it works with cartesian coordinates, only lat/longs. Did you write up how to get polymaps working with postgis?


  3. Mike, I’m using polymaps via the zoom/column/row tiling format. While my source data is indeed in lat/lon coordinates, I could have tiled up anything into the zoom/column/row format.

    You might check out the super cool work done by Jason Davies with polymaps at

    And no, I haven’t yet written anything else on this, yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s