【发布时间】:2019-03-21 11:44:13
【问题描述】:
输入文件:
{
"type": "FeatureCollection",
"name": "smth_name",
"crs": {
"type": "name",
"properties": {
"name": "urn:ogc:def:crs:EPSG::4326"
}
},
"features": [
{
"type": "Feature",
"properties": {
"testid": 2,
"other_geom": {
"type": "Point", "coordinates": [44.3, 33.3]
}
},
"geometry":{"type":"MultiPolygon",
"coordinates":[[[[33.5461,33.44],[33.441,33.447],[33.6718,33.448],[33.0188,33.441],[33.5461,33.44]]]]}
}
]
}
因此,我得到了一个点几何形状(44.3、33.3)的对象,而不是多边形对象。
如何忽略特征属性或其他复杂字段中的几何?
使用geotools gt-geojsondatastore 19.0 版本。
GeoJSONDataStore geoJSONDataStore = new GeoJSONDataStore(jsonFile.toURI().toURL());
SimpleFeature simpleFeature = geoJSONDataStore.getFeatures()...next();
Point geometry = simpleFeature.getDefaultGeometry()
【问题讨论】: