首页 > 解决方案 > 几何数据(geoJSON)未显示在我的 Geoserver 层(连接到 Mongo)

问题描述

当前运行 Geoserver 2.15。我有一个带有 GeoJSON 位置数据的 Mongo 数据库。我可以使用 gt-mongo 插件连接到我的 Mongo 数据库,并且我已经在我的几何数据上运行了一个 2dsphere 索引。该图层显示出来,我已通过 Geoserver 发布它,但是当我查看 KML/GML/GeoJSON 输出(来自图层预览)时,几何数据不存在。相反,Geoserver 说几何字段为“空”,即使我知道那里有数据。

Mongo Document(相关几何字段):

'feature_collection': {
    'features: [ {
         'geometry': { "type":"Point", 
         'coordinates: [-1.3696973576336684, 51.828414753283056]
    } ]
}

几何字段包含“Point”和“Polygon”类型,根据文档也可能为空。

我添加图层时 Geoserver 生成的架构文件:

    "typeName" : "location" ,
    "userData" : {
        "collection" : "location"} ,
    "geometryDescriptor" : {
        "localName" : "feature_collection.features.geometry" ,
         "crs" : {
              "type" : "name" ,
               "properties" : {
                   "name" : "urn:ogc:def:crs:EPSG:4326"}}} ,
    "attributeDescriptors" : [

        { "localName" : "extended_data.feature_collection.features.geometry" ,
        "type" : {
            "binding" : "org.locationtech.jts.geom.Geometry"} ,
        "userData" : {
            "encoding" : "GeoJSON" ,
            "mapping" : ".feature_collection.features.geometry"}
        }]
    }

如何让 GeoServer 显示/识别数据库中的几何数据?

标签: mongodbgeoserver

解决方案


推荐阅读