开发者

Android GoogleMaps: GeoJsonLayer.features change the order of geojson file

开发者 https://www.devze.com 2022-12-07 20:14 出处:网络
I have a location geojson file as below: { "type":"FeatureCollection", "features":[

I have a location geojson file as below:

{
"type":"FeatureCollection", 
"features":[
  {"type":"Feature","properties":{"name":"West"}},
  {"type":"Feature","properties":{"name":"East"}},
  {"type":"Feature","properties":{"name":"North"}}
]}
var geoJsonLayer = GeoJsonLayer(googleMap, R.raw.location, this)

geoJsonLayer.features.forEach {
   print(it.properties)
}

I found the order of geoJsonLayer.features becomes:

{
  "East",
  "West",
  "North"
}

The official doc does not state if it returns feature elements randomly.

I wanted to iterate the geoJsonLayer.features to get the开发者_StackOverflow中文版 properties in the order shown in the location file.

Is there any workaround?

0

精彩评论

暂无评论...
验证码 换一张
取 消