3

I am using Mapbox's QA Tiles and Python to access OSM data. While the tile-based approach is very handy I got stuck with how the geometry is saved. Apparently, coordinates are optimized for Mapbox's rendering needs and are 'vector tile grid coordinates'. To my surprise, I can't find any reference that would help me to understand what they actually did.

In my case, I want to check if a location (as latitude and longitude) are within an OSM area (Polygon or Multipolygon). This is what I got from the QA tile:

{ "osm": { "version": 2, "features": [ { "geometry": { "type": "Point", "coordinates": [ 95810, 1041260 ] }, "type": 1, "properties": { "@uid": 144382, "backrest": "yes", "@id": 3072121792, "@timestamp": 1410453825, "@changeset": 25372130, "amenity": "bench", "@user": "SHuehne", "@version": 1, "@type": "node" }, "id": 0 }, … ] "extent": 1048576 } }

This is the example node in OSM, the QA tile is z=12, x=2163, y=1435.

2 Answers 2

6

I kept on reading and I guess I found the answer myself. I won't delete the answer, maybe someone else will bump into the same problem.

mapbox-vector-tile is the library I use and its documentation explains how they transformation are done: https://github.com/tilezen/mapbox-vector-tile#coordinate-transformations-for-encoding

2
3

@linqu's answer the best for Python as per your question.

A JS implementation which extracts the VT geometry as GeoJSON is at https://github.com/mapbox/vector-tile-js/blob/master/lib/vectortilefeature.js#L129

Other JS tools which can help:

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.