tangrams / tangram

WebGL map rendering engine for creative cartography
https://tangram.city
MIT License
2.22k stars 290 forks source link

Geo.metersPerPixel is valid only on latitude 0° #780

Closed blownengine closed 3 years ago

blownengine commented 3 years ago

In Mercator projection Geo.metersPerPixel should be latitude dependent. Currently scene.view.size.meters shows invalid values.

blownengine commented 3 years ago

I'm using leaflet's distance function instead.

bcamper commented 3 years ago

That's an internal function in Web Mercator meters, which corresponds to the projection of the vector tiles. It's exposed to users in some specific cases like styling functions, but as a means to style tiles in the local space they're stored in -- not intended as a means of geographically accurate measurement. So using a utility like Leaflet's for true distance is more appropriate.