1

I've got a Tilestache server running locally with an MBTiles source file. I can get the PNG tiles without problem, but I'm having a hard time figuring out how to also get the UTFgrid.

Is it possible to use Tilestache to access the UTFgrid as well? Maybe by creating two layers in the config file?

Or should I be investing my time into looking at another tile server like Tile Cloud or something else? I'd prefer it be a python based solution.

1

Thanks for the answer, Bennos. I haven't tried that solution - I ended up using this: https://github.com/perrygeo/python-mbtiles

It's a smaller footprint than Tilestache and I liked how it could handle both the UTFGrid and Tiles from the same MBTiles file. It took a bit of modification to get to work correctly but for my purposes was better.

0

For the first question: Yes, you have to create another layer.

You can't create UTFGrids from already rendered tiles, you will have to create them from some source data (preferably the same you created your MBTiles with). I created my UTFGrid Layer with a vector file (shp) of the data and I am not sure if it is possible to use raster data.

You will need a mapnik XML-file which points to the source and another layer in your tilestache.cfg:

XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Map>

<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" maximum-extent="-20037508.34,-20037508.34,20037508.34,20037508.34">
  <Parameters>
    <Parameter name="bounds">5,43,18,50</Parameter>
    <Parameter name="center">16.7693,48.4365,9</Parameter>
  </Parameters>
  <Style name="my_grid" filter-mode="first">
    <Rule>
      <PolygonSymbolizer />
    </Rule>
  </Style>
  <Layer name="hr_p_1" srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
    <StyleName>my_grid</StyleName>
    <Datasource>
      <Parameter name="file"><![CDATA[/path/to/my_data.shp]]></Parameter>
      <Parameter name="type"><![CDATA[shape]]></Parameter>
    </Datasource>
  </Layer>
</Map>

tilestache.cfg

.
.
.
"my_layer":
{
    ...
},
"my_grid_layer":
{
    "provider": {
        "name": "mapnik grid", 
        "mapfile": "/path/to/my_grid.xml",
        "layer index": 0
    }
}
.
.
.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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