1. 安装geoserver(用在tomcat下发布的方式安装)
软件清单:
jdk-8u151-windows-x64.exe
apache-tomcat-8.5.50-windows-x64.zip
geoserver-2.15.4-war.zip
geowebcache-1.15.4-war.zip
安装jdk-8u151-windows-x64.exe
解压apache-tomcat-8.5.50-windows-x64.zip至E盘
打开E:\apache-tomcat-8.5.50\bin\ startup.bat, 在setlocal下添加环境变量
set CATALINA_HOME=E:\apache-tomcat-8.5.50
set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_151
set JRE_HOME=C:\Program Files\Java\jre1.8.0_151

解压geoserver-2.15.4-war.zip,把解压后的geoserver.war拷贝到E:\apache-tomcat-8.5.50\webapps下,
以管理员身份运行E:\apache-tomcat-8.5.50\bin\ startup.bat。
访问http://localhost:8080/geoserver/web/
账号:admin
密码:geoserver
2. 安装geowebcahce
停止tomcat
解压geowebcache-1.15.4-war.zip, 把geowebcache.war后缀改为.zip,即geowebcache.zip。
解压geowebcache.zip,在geowebcache\WEB-INF\lib得到gwc-arcgiscache-1.15.4.jar,拷贝到E:\apache-tomcat-8.5.50\webapps\geoserver\WEB-INF\lib;

找到E:\apache-tomcat-8.5.50\webapps\geoserver\WEB-INF\lib\gs-gwc-2.15.4.jar, 拷贝到其他目录下解压。在geowebcache\WEB-INF得到geowebcache-arcgiscache-context.xml拷贝到gs-gwc-2.15.4。

在gs-gwc-2.15.4\ geowebcache-servlet.xml增加
<import resource=”geowebcache-arcgiscache-context.xml”/>

在E:\gs-gwc-2.15.4\ geowebcache-core-context.xml中增加
<bean id=”gwcArcGISCacheGridsetConfiguration” class=”org.geowebcache.arcgis.layer.ArcGISCacheGridsetConfiguration” />

生成gs-gwc-2.15.4.jar:
全选,添加到压缩文件,格式.zip,生成gs-gwc-2.15.4.zip;
改后缀, .zip改为.jar,即gs-gwc-2.15.4.jar;
替换原E:\apache-tomcat-8.5.50\webapps\geoserver\WEB-INF\lib\gs-gwc-2.15.4.jar


以管理员身份运行E:\apache-tomcat-8.5.50\bin\ startup.bat
访问http://localhost:8080/geoserver/web/,打开缓存切片目录


3. 发布arcgis切片
拷贝CS_SSX切片文件夹到E:\apache-tomcat-8.5.50\webapps\geoserver\data\gwc\;
打开E:\apache-tomcat-8.5.50\webapps\geoserver\data\gwc\geowebcache.xml,添加配置
<arcgisLayer>
<name>CS_SSX</name>
<tilingScheme>E:\apache-tomcat-8.5.50\webapps\geoserver\data\gwc\CS_SSX\layer\Conf.xml</tilingScheme>
<tileCachePath>E:\apache-tomcat-8.5.50\webapps\geoserver\data\gwc\CS_SSX\layer\_alllayers</tileCachePath>
<hexZoom>false</hexZoom>
</arcgisLayer>

关闭tomcat,重新以管理员身份运行E:\apache-tomcat-8.5.50\bin\ startup.bat
浏览http://localhost:8080/geoserver/gwc/demo

点击png,用openlayers的方式浏览,地图显示空白。这是因为,当前geoserver是基于ol3浏览的,改为ol4,就能浏览到地图了。

- Openlayers(6.1.1版本)加载wms服务
以管理员身份运行vscode, file=>open folders, 选择demo, 在terminal输入npm install, 再输入npm start,访问http://localhost:1234
代码可查看

1人点赞
作者:hyl铃儿响叮当
链接:https://www.jianshu.com/p/71f75067ff62
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。