[mapserver-users] .map file wont display in Open Layers
Paul Curran
paul_everton at hotmail.com
Mon Jul 13 05:35:00 PDT 2009
Hi, If anyone can help would be greatly appreciated i have been have difficulties displaying my map in Open Layers for little while now.
I have a map file (uk.map) pulling in one layer which is a .shp file consisting of .tiff files i created using FWTools.
However i call the .map file from my html page and the map
will not display in openlayers just a blank screen within the
Open Layers Window. Can anyone see where i am going wrong?
Here is my map file
MAP
NAME ukmap
STATUS ON
IMAGETYPE PNG
IMAGECOLOR 153 204 255
# Map image size
SIZE 800 800
UNITS METERS
EXTENT -888385.321101 -31000.000000 1548385.321101 1271000.000000
PROJECTION
"AUTO"
END
# Background color for the map canvas -- change as desired
IMAGECOLOR 192 192 192
IMAGEQUALITY 95
IMAGETYPE gif
OUTPUTFORMAT
NAME gif
DRIVER 'GD/GIF'
MIMETYPE 'image/gif'
#IMAGEMODE PC256
EXTENSION 'gif'
END
# Legend
LEGEND
IMAGECOLOR 255 255 255
STATUS ON
KEYSIZE 18 12
LABEL
TYPE BITMAP
SIZE MEDIUM
COLOR 0 0 89
END
END
# Web interface definition. Only the template parameter
# is required to display a map. See MapServer documentation
WEB
# Set IMAGEPATH to the path where MapServer should
# write its output.
IMAGEPATH '/tmp/'
# Set IMAGEURL to the url that points to IMAGEPATH
# as defined in your web server configuration
IMAGEURL '/tmp/'
# WMS server settings
METADATA
'wms_title' 'ukmap'
'wms_onlineresource' 'http://my.host.com/cgi-bin/mapserv?map=wms.map&'
'wms_srs' 'EPSG:4326'
END
#Scale range at which web interface will operate
# Template and header/footer settings
# Only the template parameter is required to display a map. See MapServer documentation
END
LAYER
NAME 'map'
TYPE POLYGON
DATA 'C:\ms4w\apps\openlayers-2.5\data\map.shp'
METADATA
'wms_title' 'map'
END
STATUS DEFAULT
TRANSPARENCY 100
PROJECTION
'proj=longlat'
'ellps=WGS84'
'datum=WGS84'
'no_defs'
''
END
CLASS
NAME 'map'
STYLE
SYMBOL 0
SIZE 2
OUTLINECOLOR 0 0 0
COLOR 144 50 207
END
END
END
END
And my html page:
<html xmlns="http://www.w3.org/1999/xhtml">
<head><B><i>NARIMS MAPPING TEST</i></B>
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
var lon = 5;
var lat = 40;
var zoom = 1;
var bounds = new OpenLayers.Bounds(-888385.321101, -31000.000000, 1548385.321101, 1271000.000000);
var map, layer;
function init(){
map = new OpenLayers.Map('map', {maxExtent: bounds});
map.addControl(new OpenLayers.Control.PanZoomBar());
map.addControl(new OpenLayers.Control.MouseToolbar());
map.addControl(new OpenLayers.Control.MousePosition());
map.addControl(new OpenLayers.Control.OverviewMap());
layer = new OpenLayers.Layer.MapServer( "OpenLayers WMS",
"http://127.0.0.1/cgi-bin/mapserv.exe", { layers: 'basic', map: 'c:/ms4w/apps/openlayers-2.5/data/uk.map' }, { gutter: 15 });
map.addLayer(layer);
map.zoomToExtent(bounds);
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
}
</script>
</head>
<body onload="init()">
<div id="map"></div>
</body>
</html>
Any help much appreciated. Thanks in advance
_________________________________________________________________
Get the best of MSN on your mobile
http://clk.atdmt.com/UKM/go/147991039/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20090713/0561834a/attachment.htm>
More information about the MapServer-users
mailing list