1

我在 Maven 项目中使用FeatureJSONfromorg.geotools:gt-geojson:15-SNAPSHOT依赖项,并且可以为 GeoJSON 实例提供服务,SimpleFeature并且SimpleFeatureCollection没有任何问题。但是,我发现自己想要为 WFS 提供多种功能类型,因此我CompositeFeatureCollectionorg.geotools:gt-wfs:15-SNAPSHOT依赖项中添加了,但是当我尝试使用FeatureJSON.writeFeatureCollection(FeatureCollection, OutputStream)来编写 a时,由于返回in的实现,CompositeFeatureCollection我得到了一个NullPointerExceptionin 。writeFeatureCollection()getSchema()nullCompositeFeatureCollection

你们有谁知道 GeoTools 的这两个类 (FeatureJSONCompositeFeatureCollection) 是否旨在协同工作,如果是的话,如何做到这一点?到目前为止,Google 仅在同时搜索这两者时才显示文档结果。

为了帮助解决此问题,我创建了一个简化的测试项目,我将其推送到 GitHub,将工作和不工作的案例显示为单元测试以及CompositeFeatureCollection返回虚拟对象的 hack 子类,SimpleFeatureType并显示即使NullPointerException绕过它也会被错误地用于映射SimpleFeatureCollection传递给列表中的 each 的内容,CompositeFeatureCollection(List<FeatureCollection>)而不是SimpleFeatureTypeeach 的内部SimpleFeatureCollection

4

1 回答 1

1

目前 GeoJSON 模块仅支持简单的功能,因此需要进行一些开发工作才能引入复杂的功能。如果您有兴趣,那么一个不错的起点是不受支持的GeoJSONStore,它目前提供基于 ContentStore 的 DataStore原始 GeoJSON 模块的包装器。

于 2016-04-01T09:13:22.657 回答