logo资料库

geoserver发布mongodb矢量数据地图服务.docx

第1页 / 共7页
第2页 / 共7页
第3页 / 共7页
第4页 / 共7页
第5页 / 共7页
第6页 / 共7页
第7页 / 共7页
资料共7页,全文预览结束
MongoDB 地理空间数据存储及检索 https://blog.csdn.net/weixin_33691817/article/details/86019676 Mongodb 插件使用说明(官方): http://docs.geotools.org/latest/userguide/library/data/mongodb.html 发布步骤: 1、创建工作区: 2、创建数据存储:
说明: 1、 data_store:指定要连接的 MongoDB 实例和数据库,使用 mogodb 的 uri 方式加载 2、schema_store:schema 存储路径,有 file、mongodb 等方式。 mongodb 存储方式:这里需要指定 mongodb 数据库的 uri(同 data_store),包 括:数据、及 schema,如果不指定默认使用 geotools,collection 为 schemas 3、上面 2 项中的 uri 定义,具体可以参考:MongoClientURI 的实例化 1. 指定用户、密码: mongodb://username:password@example.com:27017/database 2、 指定集群方式:mongodb://host1:27017,host2:27017 3、发布地图服务:
1. 选择“图层”->添加新的资源: 2.选择已经创建的 mogondb 数据源: 说明:新建的时候图层都是空的 3.创建新的要素类型:
输入名称,根据实际业务名称命名即可(建议使用英文) 添加属性: 说明:必须有一个空间属性,业务属性可以根据需要添加 4、矢量数据录入: 数据如下: { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ 45.52, -122.681944 ] }, "properties": { "city": "Portland", "year": "2014" "attendance": "840" } } mongodb 中的数据如下: > db.place.find(); { "_id" : ObjectId("5e47aa22669c94555223bdcd"), "type" : "Feature", "geometry" : { "type" : "Point", "coordinates" : [ 117.12297916, 36.66033895 ] }, "properties" : { "city" : "jinan", "year" : "2020", "attendance" : "840" } } { "_id" : ObjectId("5e47aa4c669c94555223bdce"), "type" : "Feature", "geometry" : { "type" : "Point", "coordinates" : [ 117.12272167, 36.66078649 ] }, "properties" : { "city" : "jinan", "year" : "2020", "attendance" : "840" } }
{ "_id" : ObjectId("5e47aa6f669c94555223bdcf"), "type" : "Feature", "geometry" : { "type" : "Point", "coordinates" : [ 117.11954594, 36.65610441 ] }, "properties" : { "city" : "jinan", "year" : "2020", "attendance" : "840" } } { "_id" : ObjectId("5e47aa8e669c94555223bdd0"), "type" : "Feature", "geometry" : { "type" : "Point", "coordinates" : [ 117.13551044, 36.65703396 ] }, "properties" : { "city" : "jinan", "year" : "2020", "attendance" : "840" } } 对应的类型定义如下(第三步中定义的要素,包括 4 个属性:1 个空间属性、3 个普通属性): { "typeName": "places", "userData": { "collection": "places" }, "geometryDescriptor": { "localName": "location", "crs": { "properties": { "name": "urn:ogc:def:crs:EPSG:4326" }, "type": "name" } }, "attributeDescriptors": [ { }, { }, { }, { "localName": "location", "type": { "binding": "org.locationtech.jts.geom.Point" }, "userData": { "encoding": "GeoJSON", "mapping": "geometry" } "localName": "city", "type": { "binding": "java.lang.String" }, "userData": { "mapping": "properties.name" } "localName": "year", "type": { "binding": "java.lang.String" }, "userData": { "mapping": "properties.year" } "localName": "attendance", "type": { "binding": "java.lang.String" }, "userData": { "mapping": "properties.attendance" }
} ] } 4、发布地图服务: 点击“保存” 4、地图服务预览:
分享到:
收藏