从geojson检索特征

时间:2018-10-07 18:57:47

标签: android mapbox geojson

我有一个GeoJson文件读入“ ka”,我想检索一个带有“ type”:“ Feature”的要素列表。到目前为止,这是我的代码,但是功能长度最终为0。我在做什么错? (使用mapbox btw)谢谢您

        val ka = loadGeoJson()
        val obj : GeoJsonSource = GeoJsonSource("geojson", ka)
        val features : List<Feature> = obj.querySourceFeatures(Expression.eq(Expression.get("type"), "Feature"))
        Log.d("Giraffe", features.size.toString())

这是geojson:

       {
        "type": "FeatureCollection",
        "date-generated": "Sun Oct 07 2018",
        "time-generated": "00:00",
        "approximate-time-remaining": "23:59",
        "ratings": {
               "Holly": 1,
               "Bert": 2,
               "Hans": 5,
               "Penny": 2
           },
        "features": [
   {
  "type": "Feature",

  "properties": {
    "id": "1234567",
    "value": "9.481988826264946",
  },

  "geometry": {
    "type": "Point",
    "coordinates": [
      -17.1919201310830894,
      115.94309031299823
    ]
  }

}, ...etc. other entries with "type": "Feature"

0 个答案:

没有答案