Recently, I have been installing and configuring Geonetwork (a spatial metadata catalogue) for use at work. It can use a Geoserver installation to display maps within the user interface. By default it uses map services from across the internet but I needed/wanted to display our Ordnance Survey mapping in the viewer. Geonetwork has a config-gui.xml file for configuring the user interface and there are two sections where the mapping can be configured.
The small map:
<mapSearch options="{projection: 'EPSG:27700', maxExtent: new OpenLayers.Bounds(-650000, 0, 1300000, 1300000), units: 'm', restrictedExtent: new OpenLayers.Bounds(300000, 700000, 400000, 800000)}"> <layers> <!--<layer server="http://localhost/geoserver/os/wms" tocName="Miniscale" params="{layers: 'os:miniscale_std', transparent: 'true', format: 'image/png'}" options="{}" />--> <layer server="http://localhost/geoserver/os/wms" tocName="OS 50K" params="{layers: 'os:os50k_opt', format: 'image/jpeg'}" options="{isBaseLayer: true, resolutions: [350,175,84,42,21,11.5,5.6,2.8,1.4,0.7]}" /> </layers> </mapSearch>
The large map:
<mapViewer options="{projection: 'EPSG:27700', maxExtent: new OpenLayers.Bounds(-650000, 0, 1300000, 1300000), units: 'm', restrictedExtent: new OpenLayers.Bounds(300000, 700000, 400000, 800000)}"> <layers> <!--<layer server="http://localhost/geoserver/os/wms" tocName="Miniscale" params="{layers: 'os:miniscale_std', transparent: 'true', format: 'image/png'}" options="{}" />--> <layer server="http://localhost/geoserver/os/wms" tocName="OS 25K" params="{layers: 'os:os25k_opt', format: 'image/jpeg'}" options="{isBaseLayer: true, resolutions: [2800,1400,700,350,175,84,42,21,11.5,5.6,2.8,1.4,0.7]}" /> <layer server="http://localhost/geoserver/os/wms" tocName="OS 50K" params="{layers: 'os:os50k_opt', format: 'image/jpeg'}" options="{isBaseLayer: true, resolutions: [2800,1400,700,350,175,84,42,21,11.5,5.6,2.8,1.4,0.7]}" /> <layer server="http://localhost/geoserver/os/wms" tocName="OS 250K" params="{layers: 'os:os250k_opt', format: 'image/jpeg'}" options="{isBaseLayer: true, resolutions: [2800,1400,700,350,175,84,42,21,11.5,5.6,2.8,1.4,0.7]}" /> </layers> <scales values="[10000000, 5000000, 2500000, 1250000, 625000, 300000, 150000, 75000, 40000, 20000, 10000, 5000, 2500]" /> <!--<scales values="[8192, 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2]" />--> <!--<scales values="[1763.889,352.778,176.389,88.194,35.278,26.458,17.639,8.819,3.528,1.764,0.882,0.441]" />--> <proj> <crs code="EPSG:27700" default="1" name="British National Grid" /> </proj> <servers> <!--<server name="NASA JPL OneEarth Web Mapping Server (WMS)" url="http://wms.jpl.nasa.gov/wms.cgi?" /> <server name="NASA Earth Observations (NEO) WMS" url="http://neowms.sci.gsfc.nasa.gov/wms/wms?" /> <server name="DEMIS World Map Server" url="http://www2.demis.nl/mapserver/wms.asp?" />--> <server name="Geoserver" url="http://localhost/geoserver/wms?" /> <server name="eMapSite" url="http://ws.emapsite.com/view/wms/1.0/angus_council_01?" /> </servers> </mapViewer>
I’m using my local geoserver to serve EPSG:27700 or British National Grid tiles and I have linked that in to my Geonetwork.
A couple of things to note here: you can have as many layers as you want and you can set the display scales. You also need to set the WMS resolutions so that the map can be rendered at the appropriate scales. Use the layer options to set the resolutions and adjust the scales array to match the resolutions. I got my resolutions and scales from Geoserver where I have an EPSG:27700 gridset defined.
more notes to follow soon.