maplibre-rs
maplibre-rs copied to clipboard
Support other projections than the Mercator projection
In the current state of maplibre-rs, we only support the Mercator projection. This is the most used projection for modern map renderers. However there exists a large amount of other projections which have different uses.
For example, radio and seismic mapping requires the use of an equidistant projection such as The Plate Carree Equidistant Cylindrical and the Equirectangular projection.
A XYZ cartesian coordinate system will not be translated to a latitude longitude coordinate in the same way for every projection. Additionally, distances can not be calculated in the same way and tile requests must specify the projection system.
See #135 for an example where we are currently limited to the Mercator projection.
🤔 Expected Behavior
We should be able to specify a custom projection system, either through Mapbox styles or through a configuration property.
😯 Current Behavior
We only support the Mercator projection.
💁 Possible Solution
Create a trait named Projection
with functions such as XYZ to latitude/longitude conversion, distance calculator... Make different implementations for each of the supported projection systems. We also need to make sure that the target tile server has support for the requested projection.
🔦 Context
-
💻 Examples
-
One more thing: Dont't use a projection at all, use a 3D view of the Earth globe. Sould be possible as you already use the 3D rendering.
One more thing: Dont't use a projection at all, use a 3D view of the Earth globe. Sould be possible as you already use the 3D rendering.
I'm not entirely sure how well that fits in the MVT ecosystem. After all im not sure how MVT tiles are mapped on a sphere in latest mapbox.
I think a lot of people (especially swiss) have a requirement for using exact and maybe even custom projections.
There is a sweet spot to be found between all those requiremrnts.
Regarding multiple projection support, one idea could be to leverage osgeo/PROJ4 for which there are rust bindings in georust/proj. I think reimplementing a whole projection library is quite a task.
One more thing: Dont't use a projection at all, use a 3D view of the Earth globe. Sould be possible as you already use the 3D rendering.
I'm not entirely sure how well that fits in the MVT ecosystem. After all im not sure how MVT tiles are mapped on a sphere in latest mapbox.
I think if you use the WGS84 spheroid for your sphere, then you can "unproject" from EPSG:3857/pseudo mercator (most MVT come in that projection AFAIK) onto the spheroid. I guess computations are more expensive though (everything involves spherical geometry instead of simple 2D geom) but not sure if that's a big deal or not.
Ah nice, I think I finally grasp what is needed in terms of projection support. Basically where projection comes into play is when mapping tiles onto a sphere.
Sadly we can not use proj because its a large project and its not compatible with wasm afaik.
https://github.com/maplibre/maplibre-gl-js/issues/307