Setbounds for Mapbox GL JS in Albers

  Kiến thức lập trình

Are there any ways to set the initial bounds for a Mapbox GL JS map when the projection is in Albers? Example below

const map = new mapboxgl.Map({
  container: "map",
  projection: "albers",
  center: [-74.5, 40],
  zoom: 9,
  bounds: [-78, 44, -91, 39]
});

There are many issues listed on github where this problem is referenced.

Here’s a working example with default projection

https://codepen.io/dogcats/pen/mdZQBrq

Here changing the projection to Albers demonstrates the issue.

https://codepen.io/dogcats/pen/QWXJqGY

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website Kho Theme wordpress Kho Theme WP Theme WP

LEAVE A COMMENT