ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

GeoServer在Linux上源码安装、启动、发布地图服务

2022-04-23 20:05:46  阅读:227  来源: 互联网

标签:INFO geoserver SUCCESS GeoServer Module 源码 UI Linux


1. 环境准备

笔者此次使用的Linux系统是CentOS 8 ,没错,目前已经停止维护,但就操作而言,和其他Linux发行版大同小异

目前的GeoServer版本是2.21

1.1 Git环境

yum install git

Git用来获取GitHub上的源代码

1.2 Maven环境

yum install maven

Maven是GeoServer使用的管理工具

同时,Maven依赖于Java,yum在安装Maven时也下载好了Java 1.8

[root@3a310ba0df96 /]# java -version
openjdk version "1.8.0_312"
OpenJDK Runtime Environment (build 1.8.0_312-b07)
OpenJDK 64-Bit Server VM (build 25.312-b07, mixed mode)

1.3 拉取GeoServer源代码

GeoServer源代码:https://github.com/geoserver/geoserver

git clone https://github.com/geoserver/geoserver.git

1.4 使用Maven构建

参考官方手册:https://docs.geoserver.org/latest/en/developer/quickstart/maven.html

官方Github构建指南:https://github.com/geoserver/geoserver#building

cd geoserver/src
mvn install -D skipTests -T 2C

等待Maven下载jar包,直到构建完成:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] GeoServer 2.21-SNAPSHOT ............................ SUCCESS [  8.281 s]
[INFO] Core Platform Module ............................... SUCCESS [  3.460 s]
[INFO] Open Web Service Module ............................ SUCCESS [  0.684 s]
[INFO] Main Module ........................................ SUCCESS [04:19 min]
[INFO] GeoServer Security Modules ......................... SUCCESS [  3.105 s]
[INFO] GeoServer Security Tests Module .................... SUCCESS [  4.552 s]
[INFO] GeoServer JDBC Security Module ..................... SUCCESS [ 45.418 s]
[INFO] GeoServer LDAP Security Module ..................... SUCCESS [ 49.383 s]
[INFO] Web Coverage Service Module ........................ SUCCESS [  3.819 s]
[INFO] Web Coverage Service 1.0 Module .................... SUCCESS [ 47.645 s]
[INFO] Web Coverage Service 1.1 Module .................... SUCCESS [ 50.148 s]
[INFO] Web Coverage Service 2.0 Module .................... SUCCESS [  8.879 s]
[INFO] Web Feature Service Module ......................... SUCCESS [01:00 min]
[INFO] Web Map Service Module ............................. SUCCESS [01:43 min]
[INFO] KML support for GeoServer .......................... SUCCESS [  7.563 s]
[INFO] gs-rest ............................................ SUCCESS [  6.339 s]
[INFO] GeoWebCache (GWC) Module ........................... SUCCESS [ 46.647 s]
[INFO] gs-restconfig ...................................... SUCCESS [ 53.957 s]
[INFO] gs-restconfig-wcs .................................. SUCCESS [  1.968 s]
[INFO] gs-restconfig-wfs .................................. SUCCESS [  2.216 s]
[INFO] gs-restconfig-wms .................................. SUCCESS [  1.335 s]
[INFO] WMTS REST configuration ............................ SUCCESS [  1.512 s]
[INFO] GeoServer Web Modules .............................. SUCCESS [  0.159 s]
[INFO] Core UI Module ..................................... SUCCESS [01:07 min]
[INFO] WMS UI Module ...................................... SUCCESS [  3.021 s]
[INFO] GWC UI Module ...................................... SUCCESS [  3.348 s]
[INFO] WFS UI Module ...................................... SUCCESS [  1.546 s]
[INFO] Demos Module ....................................... SUCCESS [  8.639 s]
[INFO] WCS UI Module ...................................... SUCCESS [  1.684 s]
[INFO] Security UI Modules ................................ SUCCESS [  0.108 s]
[INFO] Security UI Core Module ............................ SUCCESS [  4.154 s]
[INFO] Security UI JDBC Module ............................ SUCCESS [  1.378 s]
[INFO] Security UI LDAP Module ............................ SUCCESS [  4.270 s]
[INFO] REST UI Module ..................................... SUCCESS [  1.372 s]
[INFO] GeoServer Web Application .......................... SUCCESS [01:15 min]
[INFO] Community Space .................................... SUCCESS [  0.161 s]
[INFO] GeoServer Extensions 2.21-SNAPSHOT ................. SUCCESS [  0.133 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 09:22 min (Wall Clock)
[INFO] Finished at: 2022-04-23T03:56:07Z
[INFO] ------------------------------------------------------------------------

BTW:GeoServer是基于Spring框架构建的,目前Spring cloud如火如荼,GeoServer也在往这方面发展,详见:Cloud Native GeoServer, 不过,截至目前,该项目还未正式完成

1.5 运行GeoServer

切换目录:

cd web/app

运行GeoServer:

mvn jetty:run

等待Jetty启动完成,使用浏览器输入网址:http://localhost:8080/geoserver/

image-20220423121151991

点击 图层预览,发现一个图层也没有哇:

image-20220423121657854

2. 发布地图服务

此处笔者使用的是一个shapefile的线状矢量图层,数据来源于官方自带的示例数据,位于geoserver/data/release/data/shapefiles/states.shp

2.1 图层预览

在QGIS里,图层看起来是这样的:

image-20220423124910917

2.2 登陆GeoServer

默认账户和密码:

  • 账户:admin
  • 密码:geoserver

2.3 创建一个新的工作空间

image-20220423122844336

官方文档:工作区由名称和命名空间URI(统一资源标识符)定义。工作区名称限制为10个字符,不能包含空格。URI类似于URL,只是URI不需要指向web上的实际位置,只需要是唯一的标识符。对于工作区URI,我们建议使用与项目关联的URL,可能使用不同的尾随标识符。例如, http://www.openplans.org/topp 是“topp”工作区的URI

image-20220423123326529

勾选授权所有人:

image-20220423123426464

点击保存

2.4 添加存储数据

image-20220423123655190

此处选择Shapefile:

image-20220423123750616

选择或填写相应的数据:

image-20220423124115551

点击保存

2.5 发布地图

点击发布:

image-20220423124203296

边框部分可以从数据中计算,其他默认即可:

image-20220423124400361

2.6 图层预览

点击图层预览:

image-20220423124509242

在openlayers中预览地图:

image-20220423124536085

3. 参考资料

标签:INFO,geoserver,SUCCESS,GeoServer,Module,源码,UI,Linux
来源: https://www.cnblogs.com/jiujiubashiyi/p/16183376.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有