1,通过@turf/bbox,获取minX, minY, maxX, maxY(经纬度) ,再转换成平面坐标,最后调用地图的实例方法fitScreenCoordinates

1 const geojson = this.map.getSource(id)._data
2 const bound = bbox(geojson)
3 const min = this.map.project([bound[0], bound[1]])
4 const max = this.map.project([bound[2], bound[3]])
5 this.map.fitScreenCoordinates(min, max, this.map.getBearing())

 

相关文章:

  • 2022-12-23
  • 2021-03-31
  • 2022-12-23
  • 2021-11-24
  • 2021-06-05
  • 2021-12-24
  • 2021-08-26
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2021-12-12
  • 2022-02-28
  • 2021-12-16
  • 2021-12-24
相关资源
相似解决方案