I currently develop and setup different software products which needs to display a map, like Google Maps or OpenStreetMaps. One very important requirement is to display the Map without an active internet connection. This quickly results in the idea to run my own GeoServer instance with local stored map data and distribute it via WMS (Web Map Service).
In the first step I simply added an OpenStreetMap layer and cached a few zoom levels with the built-in GWC Seed Form (batched caching) mechanism. I tested it with OpenLayers and everything worked just fine. Unfortunetaly one of the dozens software components I require, uses the NASA WorldWind viewer, which seems to use completely different zoom-levels (resolutions) than most other available viewers. Since I am new to this field I spend hours by searching for a solution, but couldn’t find anything on the internet. Until…
At some point I was able to get hands on the HTTP request URL, which the NASA WorldWind viewer sends to the server in the state where it was completely zoomed out. Pasting the URL into my browser’s address bar lead to the following response from the offline GeoWebCache server:
Request URL
/geoserver/gwc/service/wms?service=WMS&request=GetMap&version=1.1.1&srs=EPSG:4326&layers=grob_osm_wsm:all&styles=&width=512&height=512&format=image/png&transparent=TRUE&bgcolor=0x000000&bbox=54.0,36.0,72.0,54.0&
Response
400: Requested horizontal resolution: 0.140625 , best match: 0.703125 exceeds 10% threshold. Perhaps the client is configured with an incorrect set of scales (resolutions), or the DPI setting is off compared to the one in GWC ?
TL;DR It is required to create a new custom Caching Gridset, assign it to the layer which should be available and start the caching task with the GWC Seed Form.
0.140625
into the Pixel Size column. This is the horizontal resolution, which the above HTTP Response of the WMS contains.In addition to the Tile Matrix Set, it is required to set the Tile-width and -height to 512. This seems to be the default tile-size requested from WorldWind (most other applications use 256x256 px).
Always make sure that the request of your map-viewer matches exactly the settings of the cached gridset settings (resolution, tile-width, tile-height, format).
After all, this small problem costs me a lot of time and I hope this article helps somebody who faces the same problem.