• 使用GeoWebCache发布ArcGIS切片地图(实现高清电子地图)


    使用GeoWebCache发布ArcGIS切片地图(实现高清电子地图)

    一、先看效果

    图1:geoserver发布的电子地图(模糊)

    图2:GeoWebCache发布的ArcGIS切片电子地图(高清)

    image

    image

    二、版本信息

    Centos系统:CentOS Linux release 7.3.1611 (Core)

    Tomcat:apache-tomcat-8.5.65

    GeoWebCache:geowebcache-1.18.1

    三、下载安装

    1、Tomcat下载地址:https://tomcat.apache.org/download-80.cgi,安装过程这里不再赘述,不懂的可以百度。

    image

    2、GeoWebCache下载地址:https://sourceforge.net/projects/geowebcache/files/geowebcache/1.18.1/

    image

    3、GeoWebCache部署:把下载好的 geowebcache.war文件直接放入Tomcat里webapp目录,如:/usr/local/apache-tomcat-8.5.65/webapps

    image

    四、使用Bigemap下载ArcGIS瓦片数据

    image

    下载到的数据展示:

    image

    把下载好的数据上传到服务器指定目录:/usr/local/apache-tomcat-8.5.65/geowebcache

    五、GeoWebCache的配置

    1、新建缓存配置目录(姑且这么叫),并修改/usr/local/apache-tomcat-8.5.65/webapps/geowebcache/WEB-INF文件夹下的文件web.xml,在</context-param>节点后添加如下节点,记录新建的目录:

    <context-param>         
        <param-name>GEOWEBCACHE_CACHE_DIR</param-name>         
        <param-value>/usr/local/apache-tomcat-8.5.65/geowebcache/arcgis</param-value>   
      </context-param>

    param-value是你所建的文件夹,本文新建了个geowebcache和arcgis文件夹,可任意命名,只要与web.xml添加的节点中保持一致。

    2、重启tomcat服务

    会发现该目录下自动生成了几个文件,注意这里的geowebcache.xml

    image

    3、添加ArcGIS切片的路径

    修改在上文出现的/usr/local/apache-tomcat-8.5.65/geowebcache/arcgis/geowebcache.xm文件,在<layer>…</layer>节点中添加如下节点:

    注意:启动服务时该配置文件中所有服务对应的切片方案和切片路径必须都存在,否则打不开GeoWebCache主页,显示“503...”,要删去不存在的arcgisLayer节点,并重启服务!

    <!--
        tilingScheme:具体某个瓦片的配置文件的地址
        tileCachePath:具体瓦片图片的文件夹地址
    -->

    <arcgisLayer> <name>城关镇_电子地图_瓦片_ArcGis</name> <tilingScheme>/usr/local/apache-tomcat-8.5.65/geowebcache/城关镇_电子地图_瓦片_ArcGis/瓦片_ArcGis/conf.xml</tilingScheme> <tileCachePath>/usr/local/apache-tomcat-8.5.65/geowebcache/城关镇_电子地图_瓦片_ArcGis/瓦片_ArcGis/_alllayers</tileCachePath> <hexZoom>false</hexZoom> </arcgisLayer>

    image

    城关镇_电子地图_瓦片_ArcGis为服务名,GeoWebCache服务页面中可看到改名字,这里随便起的。conf.xml就是bigemap下载后的配置文件。

    4、/usr/local/apache-tomcat-8.5.65/webapps/geowebcache/WEB-INF/geowebcache-core-context.xml 需要加以下代码

    <bean id="gwcArcGIGridsetConfigutation" class="org.geowebcache.arcgis.layer.ArcGISCacheGridsetConfiguration"/>
    image

    如果不添加此bean对象,启动时则会报以下错误:

    15 Apr 14:35:15 (localhost-startStop-1) WARN [support.XmlWebApplicationContext] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gwcXmlConfig' defined in ServletContext resource [/WEB-INF/geowebcache-core-context.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: No ArcGISCacheGridsetConfiguration could be found
    15 Apr 14:35:15 (localhost-startStop-1) ERROR [context.ContextLoader] - Context initialization failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gwcXmlConfig' defined in ServletContext resource [/WEB-INF/geowebcache-core-context.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: No ArcGISCacheGridsetConfiguration could be found
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1771)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:860)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:401)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:292)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4705)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5168)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1015)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1895)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.IllegalStateException: No ArcGISCacheGridsetConfiguration could be found
        at org.geowebcache.arcgis.layer.ArcGISCacheLayer.getGridsetConfiguration(ArcGISCacheLayer.java:256)
        at org.geowebcache.arcgis.layer.ArcGISCacheLayer.createGridSubsets(ArcGISCacheLayer.java:237)
        at org.geowebcache.arcgis.layer.ArcGISCacheLayer.initializeInternal(ArcGISCacheLayer.java:205)
        at org.geowebcache.layer.AbstractTileLayer.initialize(AbstractTileLayer.java:332)
        at org.geowebcache.config.XMLConfiguration.initialize(XMLConfiguration.java:891)
        at org.geowebcache.config.XMLConfiguration.afterPropertiesSet(XMLConfiguration.java:844)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1830)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1767)
        ... 25 more
    六、浏览服务

    再次重启GeoServer,进入GeoWebCache主页:http://192.168.8.190:8080/geowebcache

    image

    image

    image

    参考网站:

    https://blog.csdn.net/hellfire2007/article/details/80876785

    https://blog.csdn.net/wt346326775/article/details/53019487

    https://my.oschina.net/u/4405061/blog/3327068

    https://www.cnblogs.com/znlgis/p/3487663.html

    https://www.cnblogs.com/Joetao/articles/4026815.html

  • 相关阅读:
    jmeter BeanShell内置变量的基本使用
    自定义 resetCSS
    JavaScript + html 制作钟表
    JavaScript 实现放大镜效果
    JavaScript 实现拖拽
    JavaScript 阻止事件的默认行为
    JavaScript 事件冒泡
    JavaScript 鼠标事件、键盘事件
    JavaScript window.location
    JavaScript 中document.getElementsByClassName() 在ie8以下不兼容问题
  • 原文地址:https://www.cnblogs.com/haolb123/p/16553078.html
Copyright © 2020-2023  润新知