如何使用Mapbox for Andriod制作叶绿素,其中数据来自GEOJSON

问题描述 投票:0回答:1

[获得具有每个国家/地区所有边界的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)
}
kotlin geojson mapbox-android
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.