gpt4 book ai didi

android - 从 GeoJsonSource 获取所有特征

转载 作者:太空狗 更新时间:2023-10-29 14:42:22 28 4
gpt4 key购买 nike

我想从 GeoJsonSource 获取所有功能,我的代码是:

GeoJsonSource geoJsonSource = new GeoJsonSource("source", loadJsonFromRaw());

for (Feature feature : geoJsonSource.querySourceFeatures(null)) {
Log.d(TAG, "onMapReady: " + feature.toJson());
}

但它总是返回一个空列表Feature

有谁知道如何从 GeoJsonSource 获取所有功能?

我的 GeoJson 文件是这样的:

{   "type": "FeatureCollection",   "features": [
{
"type": "Feature",
"properties": {
"edge_id": 1,
"detailed": "no",
"distance": 3106,
"type": "normal"
},
"geometry": {
"type": "LineString",
"coordinates": [
[
6.579816,
46.72714
],
[
6.580883,
46.728004
],
[
6.582048,
46.728982
],
[
6.583276,
46.730096
],
[
6.584309,
46.731073
],
[
6.58524,
46.73232
],
[
6.586203,
46.733657
],
[
6.5871,
46.734926
],
[
6.58787,
46.735991
],
[
6.588547,
46.73674
],
[
6.589222,
46.737624
],
[
6.590613,
46.738806
],
[
6.591552,
46.739512
],
[
6.593013,
46.740425
],
[
6.594249,
46.74111
],
[
6.59627,
46.741869
],
[
6.599075,
46.742814
],
[
6.599074,
46.742836
],
[
6.601293,
46.743506
],
[
6.60276,
46.744081
],
[
6.604356,
46.744768
],
[
6.60556,
46.745363
],
[
6.607537,
46.746509
]
]
}
},
... ] }

最佳答案

您可以使用以下方法查询源中的所有功能:source.querySourceFeatures(Expression.all())

关于android - 从 GeoJsonSource 获取所有特征,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45876423/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com