I have been looking at the UTFGrid specification and the usage of UTFGrid in Openlayers.
How do I create the required UTFGrid files for my data in PostGIS?
I have been looking at the UTFGrid specification and the usage of UTFGrid in Openlayers.
How do I create the required UTFGrid files for my data in PostGIS?
This blog post is about exactly that. Looks like TileStache will handle it for you.
You can render UTF8 grids in mapnik directly - use the mapnik grid renderer, which nicely addresses the issue of being able to produce an image in any dimension.
For example in python:
import mapnik
import json
m = mapnik.load_map("map.xml")
layer_index = 0 #First layer on the map - index in m.layers
key = "__id__" #Field used for the key in mapnik (should probably be unique)
resolution = 4 #Pixel resolution of output.
#I'm pretty sure valid valuse are 1,2 and 4, but don't quote me
fields = [] #Attributes to output against the key
d = mapnik.render_grid(m, layer_index, key, resolution, fields) #returns a dictionary
json.dump(d, open("utf8.dump", "wb"), indent=2)
If you need help building your map.xml
file for mapnik I'd go for TileMill - a really fantastic program for building mapnik xml from Carto CSS.