1

I am using Leaflet with crs: L.CRS.Simple for a game map(XY coords) with "leaflet-rastercoords" https://github.com/commenthol/leaflet-rastercoords and want to switch to maplibre (aka Mapbox). But they use different unproject methods (results):

Leaflet
map.unproject([900,900])
(and here I can use a zoom level like map.unproject([900,900], 5))
D {lat: -3.515625, lng: 3.515625}

Maplibre
map.unproject([900,900])
Ku {lng: -175.4993011138676, lat: 84.56509264504697}

Is there a way to use the same unproject method in maplibre as in Leaflet to produce the same results?

This plugin is using Leafelt this.map.unproject(coords, this.zoom); here

5
  • 1
    Since Mapbox supports only Web Mercator projection (EPSG:3857), you are out of luck here regarding the same or even similar behavior regarding coordinates as in Leaflet with LCRS.Simple projection.
    – TomazicM
    Feb 21, 2022 at 10:09
  • 1
    MapBox GL does support a few other projections now github.com/mapbox/mapbox-gl-js/pull/11124 but the MapLibre fork doesn't github.com/maplibre/maplibre-gl-js/issues/168.
    – user30184
    Feb 21, 2022 at 10:20
  • 1
    Please edit your title, it is either MapLibre of MapBox GL. MapLibre is a fork that was born when MapBox changed the license of MapBox GL.
    – user30184
    Feb 21, 2022 at 10:22
  • @user30184 but it looks like there is no CRS.Simple
    – SERG
    Feb 21, 2022 at 10:24
  • 1
    @user30184 Thanks for clarification!
    – TomazicM
    Feb 21, 2022 at 11:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.