3

I'm new to using Mapnik and TileStache. The reason i wanted to use these two pieces of software was to understand the UTFGrid specification i've seen used all over the place ( examples here, here, here )

I copied the OpenLayers examples linked to above. And i've created my own here.

I have a couple questions about Mapnik and TileStache that maybe someone here can help me resolve:

1) Does anyone know how i can display the UTF Character overlays by themselves? The endgame here is twofold -- a) i want to make a cool ascii-art-like map and b) i want to understand more about how this technology works. I assume the utfgrid overlays are drawing as vector tiles beneath the image tiles but firebug isn't showing me much.

2) It seems that the utfgrid will exactly match the the geometry it is created from in the mapnik xml file -- meaning a direct overlay. If i render custom marker .png(s) for points is there anyway to make the utfgrids overlay for the whole marker instead of just the point? Is there a way to use utfgrids with points or is it meaningless ( pointless even ;-) )?

Thanks Mazery

1 Answer 1

3

Does anyone know how i can display the UTF Character overlays by themselves?

Something like this is done by glower - it'd be possible to just display all grids all the time.

i want to understand more about how this technology works. I assume the utfgrid overlays are drawing as vector tiles beneath the image tiles but firebug isn't showing me much.

No, UTFGrid is not a vector format, and its being a raster hit-grid is the reason why it's more efficient than vectors for most use cases. The hitgrids are stored in javascript and accessed via offsets from each tile bound, so there's no default visual representation, or representation in the DOM, for the grid.

It seems that the utfgrid will exactly match the the geometry it is created from in the mapnik xml file -- meaning a direct overlay. If i render custom marker .png(s) for points is there anyway to make the utfgrids overlay for the whole marker instead of just the point? Is there a way to use utfgrids with points or is it meaningless ( pointless even ;-) )?

The Mapnik UTFGrid renderer supports any sort of feature representation (except for Raster), including points, and it will cover all semi-opaque parts of any symbolizer.

5
  • wow, a response from a creator of the spec. thanks
    – maztaz
    Commented Oct 24, 2012 at 16:33
  • a couple points of clarification if you have time. You said there's no visual or DOM representation. I'm still confused about how the look-ups work with the hit grid then. It sounds like your tile-offset position is constantly being determined on mouse movement and that position corresponds to the json grid's rows/columns. Is that how the look-up for the utf characters is done? I know i should just probably read the OpenLayers code to figure this out and i will.
    – maztaz
    Commented Oct 24, 2012 at 16:38
  • i noticed glower has a GoogleMaps and ModestMaps javascript. Is there one for OpenLayers?
    – maztaz
    Commented Oct 24, 2012 at 16:39
  • 1
    well, i can't get a better explanation than this mapbox.com/demo/visiblemap
    – maztaz
    Commented Oct 24, 2012 at 17:09
  • > It sounds like your tile-offset position is constantly being determined on mouse movement and that position corresponds to the json grid's rows/columns. Is that how the look-up for the utf characters is done? Yes - offsets based on the pixel position into a big array of strings. The encoding is just made to compress well with gzip. Right now I've only worked on glower for Modest Maps - at that point there was no UTFGrid support in OpenLayers.
    – tmcw
    Commented Oct 25, 2012 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.