3

I'm trying to use a Geoserver external WMS service in a offline environment.

First I put my own geoserver online and configure a WMS store pointig to the desired source. Next I publish the desired layer and configure Create a Cached Layer for this Layer. Next I go to GWC and seed all tiles from a bounding box from zoom level 0 to 18. I got near 10G of images.

Now I just turn off my router and go to:

geoserver/gwc/demo/myws:mylayer?gridSet=EPSG:4326&format=image/png8

but got this error:

Failed to execute request http://ORIGINAL_SOURCE_WMS/?REQUEST=GetCapabilities&VERSION=1.3.0&SERVICE=WMS`
Caused by: org.apache.commons.httpclient.ConnectTimeoutException: The host did not accept the connection within timeout of 30000 ms

As I can see the Geoserver still depending the connection.

EDIT I found this post where Ian said:

If you create your tiles using GeoWebCache GWC (and other tile caches I expect) and run the preseeding operation to create all the tiles on disk you can then copy those tiles to a remote machine and use the OpenLayers XYZLayer to access the tiles.

This can help me too since I've done all steps he describe but I'm using Cesium instead OpenLayers. Some tip about this?

Added the Cesium tag.

  • 1
    The old answer by Ian is not correct. GeoWebCache is using its own directory structure that is not the common XYZ. See for example gis.stackexchange.com/questions/242389/…. One option is to use MapProxy or MapCache which can both be configured to build XYZ cache on disk. If someone wants to contribute to GWC I suppose the place to go is in github.com/GeoWebCache/geowebcache/tree/master/geowebcache/core/…. But if you have seeded all tiles with GWC it should not need to connect to ORIGINAL_SOURCE_WMS, odd. – user30184 Sep 13 at 9:41
  • @user30184 it was my logical conclusion too. But I see cleary in the logs geoserver trying to connect to the layer's owner. When failure he throws an exception and abort instead give me the cached tiles. My logical thought was "If I have a cache here, why do I even try to see the original source? I'll give to user what I have here and go back to my nap" – Magno C Sep 13 at 13:55
  • @user30184 thanks for MapProxy or MapCache tips. If the current option doesn't work why not to try other ways? Will give a look. – Magno C Sep 13 at 14:00
  • @user30184 You did it! hurry up or you will not receive the bounty !! you have 14 hour from now. Put it as an answer ASAP. – Magno C Sep 15 at 3:29
1

As user30184 said in comments, MapProxy works very nice! Now I have my offline layer cache!

I'm using the easy Docker deploy:

https://hub.docker.com/r/kartoza/mapproxy

0

An XYZ tiles layer is a directory structure published using a webserver.

If you create the tile cache with geowebcache (as described) using the default file blob store, there will be a folder on your system with all the tiles in it.

Next you need to publish this with a webserver, e.g. apache, nginx etc.

The error you are getting is because you don't have a webserver service with a wms anymore (because you turned off the network).

  • Yeap. I know that. I just expected Geoserver / GeoWebCache could be smart enough to serve the tiles from cache when detect it have no way to reach the original WMS source. – Magno C Sep 12 at 18:56
  • 1
    BYW: Geowebcache and the file blobstore have the same file/folder structure but it is not the same structure of XYZ tiles required by OpenLayers so I can't use the cache files directly into OpenLayers. – Magno C Sep 12 at 18:58
  • I don't turned off my entire network. Just unplugged the external access so I still having access from my OpenLayer to my own Geoserver. This is not the case. – Magno C Sep 12 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.