hi,<br> I've tried to set the extend for my map all the night, but failed.<br> I set google map, world map and my own map as base maps, than i can select one from the control box. But the problem is , my map is too small——it's my university's map, and other two maybe too large. With the default setting of extent from a tutorial, I have to zoom at least 20 times to find my dormitory, else all my campus is a pixel. I've tried "SphericalMercator.forwardMercator", it failed too. Maybe I understand it in the wrong way. Here is the stuff:<br>
<br> var map;<br> function init() {<br> map = new OpenLayers.Map('map');<br> map.addControl(new OpenLayers.Control.LayerSwitcher());<br> var ext1 = OpenLayers.Layer.SphericalMercator.forwardMercator(114.330527, 30.46327);<br>
var ext2 = OpenLayers.Layer.SphericalMercator.forwardMercator(114.366537, 30.48481); <br><br> var options = {<br> projection: new OpenLayers.Projection("EPSG:900913"),<br> units: "m",<br>
maxResolution: 156543.0339,<br> // maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34)<br> maxExtent: new OpenLayers.Bounds(ext1.lon, ext1.lat, ext2.lon, ext2.lat)<br><br>};<br>
var map1 = new OpenLayers.Layer.MapServer( "OpenLayers WMS",<br> "<a href="http://kuja.oicp.net/cgi-bin/mapserv.exe">http://kuja.oicp.net/cgi-bin/mapserv.exe</a>?", { <br>
<!-- <script type="<a href="http://127.1/cgi-bin/mapserv.exe">http://127.1/cgi-bin/mapserv.exe</a>?", { ##for local--><br> map: '/ms4w/hzau/maps/map.map'} );<br> <br> var map2 = new OpenLayers.Layer.MapServer( "OpenLayers WMS",<br>
"<a href="http://kuja.oicp.net/cgi-bin/mapserv.exe">http://kuja.oicp.net/cgi-bin/mapserv.exe</a>?", { <br> <!-- <script type="<a href="http://127.1/cgi-bin/mapserv.exe">http://127.1/cgi-bin/mapserv.exe</a>?", { ##for local--><br>
map: '/ms4w/hzau/maps/123.map'} );<br> <br> var gsat = new OpenLayers.Layer.Google(<br> "Google Satellite",<br> {type: G_SATELLITE_MAP}<br> );<br><br>
<br> map.addLayers([map1, map2, gsat]);<br><br> map.setCenter(new OpenLayers.LonLat(114.349125, 30.475885), 2);<br> }<br><br><br>Did I set sth wrong? Otherwise I have to calculate the extent with calc.exe, silly way but may effects.<br>
Besides, i added <br>'wms_srs' 'EPSG:4326 EPSG:900913'<br>to all my mapfiles , and <900913...> to proj. , but still it seem to be a little drift-- 0.3 cm on my screen, i missed sth ?<br>
<br>Any helpful information will be appreciated. Tks in advance.<br><br>ps. this is my site, but it won't be available all the time, i share a adsl 2m with my roommates<br><a href="http://kuja.oicp.net">http://kuja.oicp.net</a><br>
<br>the testpage, mapserver's layer with gmap (which bothered me the whole night)<br><a href="http://kuja.oicp.net/lite4.html">http://kuja.oicp.net/lite4.html</a><br>