[mapserver-users] Open Layers Problem
Alberto Najera
anajera at bicimapas.com.mx
Fri Apr 27 11:19:22 PDT 2012
Hello
We have a map that is rendered well using the Mapserver template and are
trying to use it with OpenLayers but are experiencing some problems as the
map does not show and I cannot find why.
We are using a Linux Centos 5 remote server and the map file is located in
home/bicimapas/mapdata/BiciMapasMS.map and the Mapserver CGI is located in
/home/bicimapas/cgi-bin/mapserv. The IP address is 173.236.45.118
On the map file we added this Metadata lines under the WEB section
METADATA
"wms_title" "BiciMapasMS"
"wms_onlineresource"
"http://173.236.45.118/cgi-bin/mapserv?map=http://173.236.45.118/home/bicima
pas/mapdata/BiciMapasMS.map&"
"wms_srs" "EPSG:4326"
"wms_enable_request" "*"
END
And the metadata for the test layer was added like this
LAYER
NAME "areaurbana"
DATA "AreasMS"
STATUS on
TYPE polygon
LABELCACHE on
LABELITEM "NAME"
CLASSITEM "CATEGORY"
METADATA
"wms_title" "areaurbana"
"wms_srs" "EPSG:4326"
"wms_include_items" "all"
END
(more code here...........)
Finally, the code being used to make the Openlayers call is:
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8' />
<title>Open Layers Test</title>
<script type='text/javascript' src="OpenLayers.js"></script>
<script type='text/javascript'>
var map;
function init() {
// Setup our map object
map = new OpenLayers.Map('map_element', {});
// Setup our layer objects
var layer1 = new OpenLayers.Layer.WMS( 'Area
Urbana','http://173.236.45.118/cgi-bin/mapserv', {layers: 'areaurbana',map:
'//173.236.45.118//home/bicimapas/mapdata/BiciMapasMS.map',} );
//Add layers to the map
map.addLayer([layer1]);
// Zoom the map to the max extent
if(!map.getCenter()){
map.zoomToMaxExtent();
}
}
</script>
</head>
<body onload='init();'>
<div id='map_element' style='width: 500px; height: 500px;'>
</div>
</body>
</html>
Thanks in advance for your help
Alberto Najera
More information about the MapServer-users
mailing list