如何在弹出式上级中显示信息,并在3D地图中以多边形填充图层,并填充多边形EXTRUSSION MAPBOX

时间:2018-12-03 17:44:25

标签: popup mapbox

如何在具有3d填充挤压的mapbox geojson图层中添加用于读取2级覆盖浮点多边形的多边形的弹出窗口?

我有这个(见图片)

{"features": [  {
  "type": "Feature",
  "properties": {
    "level": 1,
    "name": "A010101",
    "height": 0.5,
    "base_height": 0,
    "color": "#E040FB"
  },
  "geometry": {
    "coordinates": [
      [
        [-77.501746,-9.624449],
        [-77.501749,-9.624451],
        [-77.501747,-9.624454],
        [-77.501744,-9.624452]
      ]
    ],
    "type": "Polygon"
  },
  "id": "1"
},

我聚集了弹出窗口,但只返回了base_height = 0的值,我想显示更高级别的信息

, {
  "type": "Feature",
  "properties": {
    "level": 3,
    "name": "A100102",
    "height": 1.8,
    "base_height": 1.3,
    "color": "#E040FB"
  },
  "geometry": {
    "coordinates": [
      [
        [-77.5018300000001,-9.62451199999999],
        [-77.5018330000001,-9.62451399999999],
        [-77.5018310000001,-9.62451699999999],
        [-77.5018280000001,-9.62451499999999]
      ]
    ],
    "type": "Polygon"
  },
  "id": "92"
}

此代码用于显示弹出窗口,其中rack6是带有多边形的geojson

map.on('click', 'rack6', function (e) {
    new mapboxgl.Popup()
        .setLngLat(e.lngLat)
        .setHTML(e.features[4].properties.name)
        //.setHTML(e.features.map(function(feature) { return feature.properties.name; }).join(', '))
        .addTo(map);
});

0 个答案:

没有答案