在mapbox里面線與面可以進行轉換,比如你需要提取一個面的邊界線,
你僅需要將 FillLayer換成LineLayer即可,反之亦然。
比如:
這是一個面:
GeoJsonSource jsonSource = new GeoJsonSource("keqioa_source", geojson);
mMapbox.getStyle().addSource(jsonSource);
FillLayer fillLayer = new FillLayer("keqioa_layer", "keqioa_source");
fillLayer.setProperties(
, fillColor(Color.WHITE)
,fillOpacity(0.3f));
提取邊界線:
LineLayer fillLayer=new LineLayer("keqioa_layer", "keqioa_source").withProperties(
lineColor(ContextCompat.getColor(GuDaoMapActivity1.this, R.color.colorAuxiliary)), lineWidth(3.0f));
mMapbox.getStyle().addLayer(fillLayer);
沒錯,就是這么簡單粗暴。