[OpenLayers-Users] TMS Overlay on WMS
Curtis Jensen
curtis at the-jensens.org
Tue Feb 9 14:08:35 EST 2010
I'm trying to overlay a TMS on a WMS. The TMS appears to be
configured for a specific max extend. If I don't use that max extend
in my WMS, then the TMS overlays on top the entire world, instead of
the area it is suppose to. Below is the WMS example that I've
modified to have an TMS overlay. I can't get it to work without
having the max extends set. However, I would like to have the whole
world shown and the TMS scaled and translated to the correct location.
Is this doable?
Thanks,
Curtis
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
<style type="text/css">
#map {
width: 512px;
height: 512px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
var lon = 5;
var lat = 40;
var zoom = 0;
var map, layer;
function init(){
<!-- map = new OpenLayers.Map( 'map' ); -->
map = new OpenLayers.Map( 'map' , {
maxExtent: new OpenLayers.Bounds( 60.470658,
29.368619, 74.888409, 38.492962 ),
resolutions: [
0.02815966992187499129,
0.01407983496093749565,
0.00703991748046874782,
0.00351995874023437391,
0.00175997937011718696,
0.00087998968505859348,
0.00043999484252929674,
0.00021999742126464837,
0.00010999871063232418,
0.00005499935531616209,
0.00002749967765808105,
0.00001374983882904052,
0.00000687491941452026,
0.00000343745970726013,
0.00000171872985363007,
0.00000085936492681503 ],
numZoomLevels: 16
});
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
map.addLayer(layer);
tmslayer = new OpenLayers.Layer.TMS("Rampant Lion",
'http://mapserver1.cmf.nrl.navy.mil/tilecache/', { isBaseLayer: false,
layername: 'AF06-NUI', type: 'png'});
map.addLayer(tmslayer);
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
map.addControl( new OpenLayers.Control.LayerSwitcher() );
}
</script>
</head>
<body onload="init()">
<h1 id="title">WMS Example</h1>
<div id="tags">
</div>
<p id="shortdesc">
Shows the basic use of openlayers using a WMS layer
</p>
<div id="map"></div>
<div id="docs">
This is an example of how to add an WMS layer to the
OpenLayers window. The images are tiled in this instance if you wanted
to not use a tiled WMS
please use this example and pass the option ‘singleTile’ as true.
</div>
</body>
</html>
More information about the Users
mailing list