首页 > 解决方案 > 根据经度和纬度获取查询RenderedFeatures的Mapbox点

问题描述

我用 Mapbox Geocoding API 找到了一个地址。然后我想在地图上突出显示该建筑物。

它适用于本机,但不适用于网络。我想在 mapBox 视图中为 renderFeatures 找到要点。

像这样的东西

pointInView = await map.getPointInView(foundAddress.center)
foundBuildings = await map.queryRenderedFeaturesAtPoint(pointInView)

如何将 long,lat 转换为 mapbox-gl-js 中的点

更新 发现有用的东西 如何在 Mapbox 中查询最接近地理编码结果的特征?

标签: mapbox-gl-js

解决方案


找到了,叫project(LngLat)

pointInView = await map.project(foundAddress.center)

请参阅:https ://docs.mapbox.com/mapbox-gl-js/api/#map#project


推荐阅读