1
私は5つのgeojsonレイヤーを持っています - 各レイヤーには1行あります。私は、map.getSourceまたはmap.getLayerを使って線の座標を取得したいと思いますが、幾何形状のプロパティは表示されません。 私はこれで座標を取得することができます。mapboxのgetSourceまたはgetLayerでジオメトリ(coord)を取得します。gl
var features = map.queryRenderedFeatures({layers:[layerName]});
console.log(features[0].geometry);
私にGeoJSONは次のとおりです。
var layer = map.addLayer({
"id": layerName,
"type": "line",
"source": {
"type": "geojson",
"data": {
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": line
}
}
},
"layout": {
"line-join": "round",
"line-cap": "round"
},
"paint": {
"line-color": "red",
"line-width": 13
}
});