简体   繁体   中英

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

I have two layers built on FeatureCollection GeoJSON data. One of them is of type circle and the other is 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. The question is, how to do this in Mapbox?

Here's what I've tried:

GeoJSON feature coordinates

An OPTIONAL third-position element SHALL be the height in meters above or below the WGS 84 reference ellipsoid. 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 .

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.

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 .

There is no support for setting elevation on symbol layers. See https://github.com/mapbox/mapbox-gl-js/issues/3993 and https://github.com/mapbox/mapbox-gl-js/issues/10483

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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