mapbox自定义标记作为地图上的“支柱”

问题描述 投票:0回答:1
我的目标是让我的标记像柱子一样在90度上与Mapbox Map。

就像以下:

Globe Expection 我从

https://github.com/vasturiano/globe.gl

目前,我有此代码可以添加标记,但它不起作用。

const customMarker = document.createElement("div"); const backGroundColor = theme == "dark" ? "bg-white/90" : "bg-black/90"; customMarker.className = "w-2 h-20 rounded-full" + " " + backGroundColor; if (!device.location?.longitude || !device.location?.latitude) return; new mapboxgl.Marker({ element: customMarker, pitchAlignment: "map", rotationAlignment: "map" }) .setLngLat([device.location?.longitude, device.location?.latitude] as [ number, number ]) .setRotation(45) .addTo(mapRef.current!);

this这样的标记:

Faulty Globe 我在2007 - 09年左右在虚拟地球上做了广泛的工作。根据您的代码,您已经阅读了它,从最后一行的代码中,您提到的.setRotation(45)。通过.setRotation(90)尝试一下。它可能起作用

reactjs mapbox mapbox-gl-js mapbox-marker
1个回答
0
投票
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.