GeoServer系列-安装Mongodb插件

GeoServer 安装包中是不含mongodb插件的,所以无法创建mongodb的数据存储,要想支持发布mongodb的空间表到geoserver就需要添加插件

1,下载插件

官网下载地址:GeoServer,注意在自己geoserver版本的页面下载
image

2,安装插件

解压压缩包下的jar包,复制到geoserver安装目录下的 GeoServer\webapps\geoserver\WEB-INF\lib

3,重启geoserver

重启后在数据存储即可看到
image

4,添加数据源

image
有密码的格式如下

mongodb://USERNAME:PASSWORD@IP:PORT/DATABASE?authMechanism=SCRAM-SHA-1&authSource=DATABASE

5,发布图层

发布图层与其他数据源类似,选择存储仓库后,选择图层即可发布。
需要注意的是空间字段 geometry 必须要加索引,否则在geoserver界面看不到
要测试预览可以先造一条空间数据,然后发布

db.createCollection("mongo_rect");

db.mongo_rect.insert({ "type": "Feature", "properties": { "name": "tect1", "code": "rect1" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 102.2201, 36.0388 ], [ 102.2201, 38.8592 ], [ 106.6959, 38.8592 ], [ 106.6959, 36.0388 ], [ 102.2201, 36.0388 ] ] ] ] } });

db.mongo_rect.createIndex({
    "geometry": "2dsphere"
});

猜你喜欢

转载自blog.csdn.net/u012796085/article/details/128739853
今日推荐