FeatureJSON using CompositeFeatureCollection



我正在Maven项目中使用来自org.geotools:gt-geojson:15-SNAPSHOT依赖项的FeatureJSON,并且我能够为SimpleFeatureSimpleFeatureCollection的实例提供GeoJSON,而不会出现任何问题。然而,我发现自己想为WFS提供多种功能类型,因此我从org.geotools:gt-wfs:15-SNAPSHOT依赖项中添加了CompositeFeatureCollection,但当我尝试使用FeatureJSON.writeFeatureCollection(FeatureCollection, OutputStream)编写CompositeFeatureCollection时,由于getSchema()CompositeFeatureCollection中返回null的实现,我在writeFeatureCollection()中得到了NullPointerException

你们中有人知道GeoTools的这两个类(FeatureJSONCompositeFeatureCollection)是否被设计为可以一起工作吗?如果是,如何做到这一点?到目前为止,谷歌只在一起搜索这两个文件时才会出现文档结果。

为了帮助解决这个问题,我创建了一个简化的测试项目,我推送到GitHub,将工作和不工作的情况显示为单元测试,再加上CompositeFeatureCollection的一个hack子类,它返回一个伪SimpleFeatureType,并显示即使绕过这个NullPointerException,它也是如何被错误地用于映射传递给CompositeFeatureCollection(List<FeatureCollection>)而不是SimpleFeatureType的列表中每个SimpleFeatureCollection的内容在每个CCD_ 22内部。

目前GeoJSON模块只支持简单的功能,因此需要进行一些开发工作才能引入复杂的功能。如果您感兴趣,那么最好从不支持的GeoJSONStore开始,它目前为原始GeoJSON模块提供了基于ContentStore的DataStore包装。

相关内容

  • 没有找到相关文章

最新更新