简体   繁体   English

如何在 Mapbox 中指定圆圈或符号图层的高度?

[英]How to specify altitude for a circle or symbol layer in Mapbox?

I have two layers built on FeatureCollection GeoJSON data.我有两层基于FeatureCollection GeoJSON 数据。 One of them is of type circle and the other is symbol .其中一个是circle类型,另一个是symbol类型。 Here they are:他们来了:

在此处输入图像描述

Thing is, as you can see in our project we use 3D buildings on the map, and we need our objects to be at a certain altitude above the ground.问题是,正如您在我们的项目中看到的那样,我们在 map 上使用 3D 建筑物,我们需要我们的对象位于地面以上的特定高度。 The question is, how to do this in Mapbox?问题是,如何在 Mapbox 中做到这一点?

Here's what I've tried:这是我尝试过的:

GeoJSON feature coordinates GeoJSON 特征坐标

An OPTIONAL third-position element SHALL be the height in meters above or below the WGS 84 reference ellipsoid.可选的第三位置元素应为 WGS 84 参考椭球上方或下方的高度(以米为单位)。 In the absence of elevation values, applications sensitive to height or depth SHOULD interpret positions as being at local ground or sea level.在没有高程值的情况下,对高度或深度敏感的应用程序应该将位置解释为处于当地地面或海平面。 GeoJSON spec . GeoJSON 规范

I've tried setting the third argument for a feature's geometry, which is a point, but it didn't help.我尝试为要素几何设置第三个参数,这是一个点,但没有帮助。 Looks like the third value is just being ignored.看起来第三个值只是被忽略了。

      return {
        type: 'Feature',
        id: l.id,
        geometry: {
          type: 'Point',
          coordinates: [l.coordinates.lng, l.coordinates.lat, 50]
        }
      }

circle-translate

The geometry's offset.几何体的偏移。 Values are [x, y] where negatives indicate left and up, respectively.值为 [x, y],其中负数分别表示左和上。

I've tried setting this but the result looked super weird, it didn't look like a normal elevation.我试过设置它,但结果看起来非常奇怪,它看起来不像正常的海拔。

Example例子

I've modified an example from Mapbox so you can play around with this — here .我已经修改了 Mapbox 中的一个示例,因此您可以使用它 -这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM