0

A web app I use displays map tiles from mapbox and then uses leaflet to overlay that map with an svg path representing a route.

The problem is that the area given to the map is very tiny, it's short and wide. I'd like to create an extension that takes the map, examines the route, and then creates a kml file representing the route.

How do I map from mapbox tiles to their real world lat and lon?

1

I'd like to create an extension that takes the map, examines the route, and then creates a kml file representing the route.

If it uses Leaflet, then the quickest way is to get a reference to the polyline layer and run toGeoJSON(), then use a tool like ogr2ogr to transform the GeoJSON into KML.

I'm assuming you have access to the source code of the Leaflet part of the app, or that you're good at inspecting javascript variables.

How do I map from mapbox tiles to their real world lat and lon?

This is a different matter. The projection used by Mapbox is generic, and the format of the tile pyramid is very well documented at https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames

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.