[获得具有每个国家/地区所有边界的GEOJSON文件后。发件人:https://datahub.io/core/geo-countries#data
[对于使用Kotlin构建的Andriod应用程序,如何使用Mapbox生成chloropleth。
private fun drawBoundaries(){
mapboxMap.getStyle {
try {
val source = GeoJsonSource("geojson-source", URI("assets://countries.geojson"))
it.addSource(source)
} catch (exception: URISyntaxException) {
Log.d(TAG, exception.toString())
}
}
}
而且我猜链接中的填充如下:https://docs.mapbox.com/android/maps/overview/data-driven-styling/#fill
mapboxMap.getStyle {
val fillLayer = FillLayer("layer-id", "source-id")
fillLayer.setProperties(PropertyFactory.fillColor(Color.GREEN))
it.addLayer(fillLayer)
}