[mapserver-users] Projection Extent and Zoom issues - Openlayers
Paul Curran
paul_everton at hotmail.com
Wed Aug 12 00:52:36 PDT 2009
Hi,
I have had this problem for a couple of weeks now and I still cant get past it. Basically when I view my map of the UK via openlayers it is zoomed in very close. I want to zoom out but whatever I try doesn’t work – usually results in just the background colour of my map being displayed.
I believe it might be my EXTENT which is incorrect as I am using epsg:4326 (a spherical coordinate system). My map file is a Mapserver Export from Quantim GIS and gave me the EXTENT -888385.321101 -31000.000000 1548385.321101 1271000.000000. How can I convert this into a Geographic extent to match with my projection (epsg:4326)?
My map and javascript file is below.
Any help greatly appreciated
Thanks
MAP
NAME UK1
PROJECTION
"init=epsg:4326"
END
SIZE 1600 1200
IMAGECOLOR 153 204 255
IMAGETYPE JPEG
SHAPEPATH "http://localhost/openlayers/data/"
EXTENT -888385.321101 -31000.000000 1548385.321101 1271000.000000 UNITS DD
WEB
TEMPLATE "http://localhost/openlayers/examples/test.html"
LOG "\ms4w\tmp\ms_tmp\log.txt"
IMAGEPATH "\ms4w\tmp\ms_tmp\"
IMAGEURL "/ms_tmp/"
METADATA
'wms_title' "map"
'wms_onlineresource' "http://127.0.0.1./cgi-bin/mapserv?map=uk1.map"
END
END
LAYER
NAME "UK"
METADATA
'wms_title' "wms_demo"
END
STATUS DEFAULT
TYPE raster
TILEINDEX "map"
TILEITEM "Location"
PROJECTION
"init=epsg:4326"
END
CLASS
STYLE
COLOR 0 0 0
END
LABEL
COLOR 0 0 0
SIZE SMALL
END
END
END
END
Openlayers File:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>MAPPING TEST
<style type="text/css">
#map {
width: 90%;
height: 90%;
border: 8px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
var zoom = 100;
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, numZoomlevels: 10 });
map.addControl(new OpenLayers.Control.PanZoomBar());
map.addControl(new OpenLayers.Control.OverviewMap());
map.addControl(new OpenLayers.Control.MousePosition());
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://127.0.0.1/cgi-bin/mapserv.exe?", { layers: 'uk', map: '/ms4w/apps/openlayers-2.5/data/uk1.map' },
{ gutter: 15 });
map.addLayer(layer);
map.zoomToExtent(bounds);
map.setCenter(new OpenLayers.zoom);
}
</script>
</head>
<body onload="init()">
<div id="map"></div>
</body>
</html>
_________________________________________________________________
Windows Live Messenger: Thanks for 10 great years—enjoy free winks and emoticons.
http://clk.atdmt.com/UKM/go/157562755/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20090812/895dd790/attachment.htm>
More information about the MapServer-users
mailing list