1 |
3032
|
perry
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
2 |
|
|
<head>
|
3 |
|
|
<meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
|
4 |
|
|
<style type="text/css">
|
5 |
|
|
#map {
|
6 |
|
|
width: 512px;
|
7 |
|
|
height: 512px;
|
8 |
|
|
border: 1px solid black;
|
9 |
|
|
}
|
10 |
|
|
</style>
|
11 |
|
|
<script src="../lib/OpenLayers.js"></script>
|
12 |
|
|
<script type="text/javascript">
|
13 |
|
|
<!--
|
14 |
|
|
var map, layer;
|
15 |
|
|
var size, icon;
|
16 |
|
|
|
17 |
|
|
function init(){
|
18 |
|
|
map = new OpenLayers.Map('map');
|
19 |
|
|
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
20 |
|
|
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
|
21 |
|
|
|
22 |
|
|
map.addLayer(layer);
|
23 |
|
|
var markers = new OpenLayers.Layer.Markers( "Markers" );
|
24 |
|
|
map.addLayer(markers);
|
25 |
|
|
|
26 |
|
|
size = new OpenLayers.Size(50,50);
|
27 |
|
|
calculateOffset = function(size) {
|
28 |
|
|
return new OpenLayers.Pixel(-(size.w/2), -size.h); };
|
29 |
|
|
icon = new OpenLayers.Icon(
|
30 |
|
|
'http://boston.openguides.org/markers/AQUA.png',
|
31 |
|
|
size, null, calculateOffset);
|
32 |
|
|
markers.addMarker(
|
33 |
|
|
new OpenLayers.Marker(new OpenLayers.LonLat(-180,90), icon));
|
34 |
|
|
|
35 |
|
|
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
36 |
|
|
map.zoomToMaxExtent();
|
37 |
|
|
}
|
38 |
|
|
|
39 |
|
|
function resize() {
|
40 |
|
|
|
41 |
|
|
size = new OpenLayers.Size(size.w + 10, size.h + 10);
|
42 |
|
|
icon.setSize(size);
|
43 |
|
|
|
44 |
|
|
}
|
45 |
|
|
// -->
|
46 |
|
|
</script>
|
47 |
|
|
</head>
|
48 |
|
|
<body onload="init()">
|
49 |
|
|
<h1>OpenLayers Example</h1>
|
50 |
|
|
<div id="map"></div>
|
51 |
|
|
<div style="background-color:purple" onclick="resize()"> click to resize marker</div>
|
52 |
|
|
</body>
|
53 |
|
|
</html>
|