使用 CompositeFeatureCollection 的 FeatureJSON

FeatureJSON using CompositeFeatureCollection

我正在使用 FeatureJSON from org.geotools:gt-geojson:15-SNAPSHOT dependency in a Maven project and I'm able to serve GeoJSON for instances of SimpleFeature and SimpleFeatureCollection without any problems. However I find myself wanting to serve WFS with multiple feature types and so I added CompositeFeatureCollection from the org.geotools:gt-wfs:15-SNAPSHOT dependency but when I try and use FeatureJSON.writeFeatureCollection(FeatureCollection, OutputStream) 编写一个 CompositeFeatureCollection 由于 getSchema() 返回 nullCompositeFeatureCollection.

你们中有人知道 GeoTools 的这两个 类(FeatureJSONCompositeFeatureCollection)是否设计为可以协同工作,如果可以,如何协同工作? Google 到目前为止只在同时搜索这两个时出现文档结果。

为了帮助解决此问题,我在每个 SimpleFeatureCollection.

中创建了一个 simplified test project I pushed to GitHub showing the working and not working cases as unit tests plus a hack subclass to CompositeFeatureCollection that returns a dummy SimpleFeatureType and shows how even when this NullPointerException is bypassed this is erroneously used for mapping the contents of each SimpleFeatureCollection in the list that is passed to CompositeFeatureCollection(List<FeatureCollection>) 而不是 SimpleFeatureType

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