Warning: Not all map services providers(WMS included) allow their maps to be cached by others. Before using MapViewer to cache maps served by any third party map services provider, you should consult the map services provider to make sure you're allowed to cache their maps.
A map source adapter is basically a Java class that is called by MapViewer to construct requests understood by the external map services provider. MapViewer calls the map source adapter to construct map requests, send them to the map services provider, fetch the maps and cache them as map tiles. Mapviewer is shipped with a map source adapter for WMS, which you can use to cache maps served by a WMS server. To better understand how the map source adapter works, you can take a look at the source code of the WMS adapter, which can be found at $mapviewer_deploy_home/web/WEB-INF/tileserver/mvadapter/mcsadapter/WMSAdapter.java.
Here are the steps to create a map tile layer using the WMS adapter.
1. Login MapViewer's web admin page.
2. Enter the tile layer creation interface. Choose "External" when being asked for the the type of map source.
3. On the tile layer creation page, you need to provide the configuration information for the map tile layer. Besides regular tile layer configuration options such as name, data source, coordinate system, zoom level definition and etc, you also need to provide the following information specific to an external map tile layer.
- Map service URL: The URL of the external map services provider. In the case of WMS, it should be the URL of the WMS server, e.g. http://www.myhost.com/mywms.
- Adapter class: The path of the WMS adapter class. It should be mcsadapter.WMSAdapter.
- Jar file location: the full path of the file mvadapter.jar, which is under $mapviewer_deploy_home/web/WEB-INF/tileserver/mvadapter.
- Check "Adapter properties".
- Add WMS parameters(name and value) for your map requests. Example:
name value
----------- -----
version 1.1.1
srs EPSG:4326
layers Countries,Borders
format image/png
transparent true
4. Click "Submit" to create the tile layer.
2 comments:
Hi,
I'm trying to cach google maps tile layer but without success.
Please can help me to figure this out.
Ramzi
Technically it is possible with external map source adapter and google maps static map api.
But caching google maps tiles without their permission is against the terms of service of google maps.
Post a Comment