[OpenLayers-Users] Adding a Mapserv Layer
Matthew Pulis
mpulis at gmail.com
Sun Nov 18 12:02:23 EST 2007
I am just working to get my Mapscript fixed, since I decided to pass
all the map info to mapscript and just pass the image to load.
This is the new Openlayers script : <html>
<head>
<title>OpenLayers Example</title>
<style type="text/css">
#map {
width: 800px;
height: 600px;
border: 1px solid black;
}
</style>
<script src="http://yancho.no-ip.org/~yancho/OpenLayers.js"></script>
<script type="text/javascript">
var lon = -79;
var lat = 33.75;
var zoom = 0;
var map, layer;
function init(){
map = new OpenLayers.Map('map');
//map.addControl(new OpenLayers.Control.MousePosition());
map.addControl(new OpenLayers.Control.LayerSwitcher());
layer = new OpenLayers.Layer.MapServer( "Streets Layer",
"http://yancho.no-ip.org/~yancho/cgi-bin/mapserv",{map:'/home/yancho/public_html/nc/sample.map'},
{gutter: 15}
);
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
map.addControl( new OpenLayers.Control.LayerSwitcher() );
}
</script>
</head>
<body onload="init()">
<div id="map"></div>
</html>
And can be found pastebinned here : http://pastebin.com/f170edb33
Will keep this thread updated after I fix my mapscript and if I manage
to make it work I'll post both scripts just incase someone has the
same problem like I have :)
Thanks to all :)
Until next post .. cya
More information about the Users
mailing list