我想知道GeoJSON数据的FeatureCollection通常是如何过滤的。例如,使用以下earthquake data
{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "id": "ak16994521", "mag": 2.3, "time": 1507425650893, "felt": null, "tsunami": 0 }, "geometry": { "type": "Point", "coordinates": [ -151.5129, 63.1016, 0.0 ] } },
{ "type": "Feature", "properties": { "id": "ak16994519", "mag": 1.7, "time": 1507425289659, "felt": null, "tsunami": 0 }, "geometry": { "type": "Point", "coordinates": [ -150.4048, 63.1224, 105.5 ] } },
{ "type": "Feature", "properties": { "id": "ak16994517", "mag": 1.6, "time": 1507424832518, "felt": null, "tsunami": 0 }, "geometry": { "type": "Point", "coordinates": [ -151.3597, 63.0781, 0.0 ] } },
{ "type": "Feature", "properties": { "id": "ci38021336", "mag": 1.42, "time": 1507423898710, "felt": null, "tsunami": 0 }, "geometry": { "type": "Point", "coordinates": [ -118.497, 34.299667, 7.64 ] } },
{ "type": "Feature", "properties": { "id": "hv61900626", "mag": 2.91, "time": 1504833891990, "felt": null, "tsunami": 0 }, "geometry": { "type": "Point", "coordinates": [ -155.011833, 19.399333, 2.609 ] } }
]
}现在,如果这些数据都在单个FeatureCollection中,那么如何过滤数据,例如使用magnitude > 2.5查看地震?似乎在处理FeatureCollection时,首先要做的是将每个功能提取到它自己的项中:这是通常所做的吗,以便可以查询单个属性?
发布于 2021-05-11 15:32:16
GeoJSON是一种传输格式,您已经注意到,对它的任何操作都需要每次读取和解析整个文件。如果您计划对数据执行任何操作,则应该将其转换为支持索引的更有用的格式。如果您需要保持基于文件的格式,那么我推荐大多数现代地理信息系统都支持的GeoPackage。或者,您可以使用空间上可用的数据库,比如PostGIS。
在任何一种情况下,转换数据的最简单方法都是使用ogr2ogr
https://stackoverflow.com/questions/67477187
复制相似问题