danzel / Leaflet.utfgrid

A UTFGrid implementation for leaflet that is super small.
MIT License
131 stars 51 forks source link

utfgrid example mb-util #30

Closed riccardoklinger closed 9 years ago

riccardoklinger commented 9 years ago

I am working with mb-util to export the utfgrid and mbtiles with the following command: mb-util --scheme=xyz /folder/tile.mbtiles /var/www/html/my-tiles when using the same syntax like in your example I get the following error in the console: ReferenceError: grid is not defined my grid.json files normaly look like this: grid({"keys": ["", "6402"], "data": {"6402": {"namen": "cool name", "attrib 1": 0.123456}}, "grid": [" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " !!! ", " !!!!! ", " !!!!!!! ", " !!!!!!!! ", " !!!!!!!!! ", " !!!! !!!! ", " !! !!!!! ", " !!! !!!!! ", " ! ! ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "]}); Is it possible for you to update your example/instruction for mb-util users who would like to be independet from mapbox?!

danzel commented 9 years ago

Your grid.json has grid( at the start (and a matching ); at the end). If you get rid of that then you can use useJsonP: false and it should work I think?

riccardoklinger commented 9 years ago

hi dave, thanks for the reply. I've created also a question on gis.stackexchange: http://gis.stackexchange.com/questions/127955/serving-utfgrid-information-made-with-mb-util-with-leaflet

maybe it will give some more information... I'll try your suggestion and report back in!

riccardoklinger commented 9 years ago

it was working! so you you need to create the tiles with the following command: mb-util --grid_callback="" tiles.mbtiles path/to/tiles when you open the index.html make sure it is in the same folder as your utfgrid tiles. It will also throw an error when you open the index.html in the browser with var/www/html/index.html but define your utfgrid like http://localhost/z/x/y... Now everything is fine! Thanks again for the suggestion!