根据GeoJson规范(https://tools.ietf.org/html/rfc7946),允许使用具有不同属性集的功能,但是当我使用FeatureJSON.readFeatureCollection
处理我的GeoJson文件时,我收到错误no such attribute:tract_boundary
。
这是我的文件中显示具有不同属性的两个功能的部分(注意属性名称“tract_boundary”出现在第二个功能属性中):
{
"type": "Feature",
"properties": {
"clu_identifier": "3ecc54fc-5077-11d6-8e82-00065b4a19c0",
"clu_alt_id": "{5626C60F-23B1-4172-BCFA-842EBDEE776F}",
"data_source": "danna.steffens",
"clu_status": null,
"tract_number": "768",
"last_change_date": 1352656579000,
"last_chg_user_nm": null,
"creation_date": 1113921633000,
"admin_state": "20",
"clu_calculated_acreage": 152.41,
"OBJECTID": 582,
"cropland_indicator_3CM": 1,
"edit_reason": null,
"GlobalId": "{DE7A11AA-BFB6-4DFE-A1D7-D795D7DD7990}",
"SHAPE_STArea__": 1012852.6422872,
"state_code": "20",
"cdist_fips": "2001",
"highly_erodible_land_type_code": "NHEL",
"admin_county": "171",
"clu_classification_code": "2",
"sap_crp": null,
"farm_number": "4384",
"SHAPE_STLength__": 4161.19756459,
"ESRI_OID": 530,
"clu_number": "1",
"data_source_site_identifier": null,
"comments": " ",
"county_code": "171"
},
"geometry": {...
},
{
"type": "Feature",
"properties": {
"farm_number": "4384",
"admin_state": "20",
"tract_number": "5468",
"admin_county": "171",
"tract_boundary": true
},
"geometry": {...
}
有什么想法吗?
答案 0 :(得分:0)
你可以得到#34;完整的"模式通过调用org.geotools.geojson.feature.FeatureJSON.readFeatureCollectionSchema(Object, boolean)
并将第二个参数设置为false,以便读取整个集合而不仅仅是第一个项目。然后,您可以正确设置功能的FeatureType
。