Adding The Necessary Script References
Adding The Necessary Script References
Page 1 of 1
<script src='http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js'></script>
<script src="ol22/OpenLayers.js"></script>
Alternatively, you can use the latest release OpenLayers.js directly from the OpenLayers site by replace line 12 with
12:
<script src="http://openlayers.org/api/OpenLayers.js"></script>
Next we write the javascript code to create the map and load into our div and add the layers
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
A couple of notes about the above code that may not be entirely obvious
In the UMN MapServer WMS we have extra slashes for the map file because our map location has \. E.g its \\dndwms instead of just \. This is to escape out the \. Future versions of Open
Layers will do this automatically.
For the WMS layers we specified a tileSize and buffer. This is to prevent Open Layers from slicing up the tiles on the server too granulary - otherwise it will ask for a lot more tiles per call. The
layers we are overlaying are fairly light so don't need many calls.
http://www.bostongis.com/?content_name=openlayers_tut_01
6/29/2013