如何在mapbox-gl地图上显示自定义建筑物

发布于 2025-01-19 01:01:22 字数 291 浏览 1 评论 0原文

我不想在地图上显示我自己的建筑物(如示例所示)。它们应该是静态的 - 我的屏幕示例

在屏幕截图中,您可以看到带有标记构建的示例(它会移动在地图上移动或放大/缩小)

我的目的 - 这个 视图

我想用它创建地图等距建筑物,可以有不同的不透明度

I wan't to display my own buildings on map(as in example). They should be static - my screen example

At screenshot you can see example with marker building(it moves on map move or zoom in/out)

My purpose - this view

I want to create map with isometric buildings, which can have different opacity

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

痴梦一场 2025-01-26 01:01:22

看看: https:// docs。 mapbox.com/mapbox-gl-js/example/image-on-a-map/

应将每个构建图像添加为带有coordinates参数指定坐标的栅格层建筑物的边界:

map.addSource('building1', {
  'type': 'image',
  'url': 'building1.png',
  'coordinates': [
    [-80.425, 46.437],
    [-71.516, 46.437],
    [-71.516, 37.936],
    [-80.425, 37.936]
  ]
});

随着您放大和缩小以维护正确的坐标,图像将自动扩展。

Take a look at: https://docs.mapbox.com/mapbox-gl-js/example/image-on-a-map/

Each of your building images should be added as a raster layer with the coordinates argument specifying the coordinate boundaries of the building:

map.addSource('building1', {
  'type': 'image',
  'url': 'building1.png',
  'coordinates': [
    [-80.425, 46.437],
    [-71.516, 46.437],
    [-71.516, 37.936],
    [-80.425, 37.936]
  ]
});

The images will automatically scale as you zoom in and out to maintain the correct coordinates.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文