1 <html xmlns=
"http://www.w3.org/1999/xhtml">
3 <title>OpenLayers GML Layer Example
</title>
4 <link rel=
"stylesheet" href=
"style.css" type=
"text/css" />
5 <script src='http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=
6.1'
></script>
6 <script src=
"../OpenLayers.js"></script>
7 <script type=
"text/javascript">
15 var map
, layer
, markers
;
16 var markersList
=new Array();
17 var points
=new Array();
19 OpenLayers
.Control
.Click
= OpenLayers
.Class(OpenLayers
.Control
, {
20 defaultHandlerOptions
: {
28 initialize: function(options
) {
29 this.handlerOptions
= OpenLayers
.Util
.extend(
30 {}, this.defaultHandlerOptions
32 OpenLayers
.Control
.prototype.initialize
.apply(
35 this.handler
= new OpenLayers
.Handler
.Click(
38 }, this.handlerOptions
42 trigger: function(e
) {
43 var lonlat
= map
.getLonLatFromPixel(e
.xy
);
44 var size
= new OpenLayers
.Size(10,17);
45 var offset
= new OpenLayers
.Pixel(-(size
.w
/2), -size
.h
);
46 var icon
= new OpenLayers
.Icon('http://boston.openguides.org/markers/AQUA.png',size
,offset
);
47 markersList
[numclick
]=new OpenLayers
.Marker(new OpenLayers
.LonLat(lonlat
.lon
,lonlat
.lat
),icon
);
48 markers
.addMarker(markersList
[numclick
]);
49 points
[numclick
]=lonlat
;
50 points
[numclick
].transform(map
.getProjectionObject(),proj
);
56 image
=document
.getElementById("image");
57 //OpenLayers.ProxyHost="/proxy/?url=proxy.unitn.it:3128";
58 proj
=new OpenLayers
.Projection("EPSG:4326");
60 projection
: new OpenLayers
.Projection("EPSG:900913"),
61 displayProjection
: new OpenLayers
.Projection("EPSG:4326"),
64 maxResolution
: 156543.0339,
65 maxExtent
: new OpenLayers
.Bounds(-20037508, -20037508,
66 20037508, 20037508.34)
68 map
= new OpenLayers
.Map('map',options
);
69 layer
= new OpenLayers
.Layer
.VirtualEarth( "VE",{'type': VEMapStyle
.Aerial
, 'sphericalMercator': true});
71 var bounds
= new OpenLayers
.Bounds(11,46.4,11.2,46.6)
72 map
.zoomToExtent(bounds
.transform(proj
, map
.getProjectionObject()));
73 markers
= new OpenLayers
.Layer
.Markers( "Markers" );
74 map
.addLayer(markers
);
75 click
=new OpenLayers
.Control
.Click();
76 map
.addControl(click
);
82 for(i
=0;i
<markersList
.length
;i
++){
83 markers
.removeMarker(markersList
[i
]);
85 map
.removeLayer(path
);
90 for(i
=0;i
<points
.length
-1;i
++){
91 queryPoints
+=points
[i
].lon
+","+points
[i
].lat
+",";
93 queryPoints
+=points
[points
.length
-1].lon
+","+points
[points
.length
-1].lat
;
95 path
=new OpenLayers
.Layer
.GML("GML", "cgi-bin/wps.py?service=wps&request=execute&version=1.0.0&identifier=shortestpath&datainputs=[cost=8923;coord="+queryPoints
+"]", {projection
:proj
});
97 image
.innerHTML
="<img name=\"image\" src=\"profile.png\">";
103 function refreshImage(){
106 tmp
= "?"+tmp
.getTime()
107 document
.images
["image"].src
= "profile.png"+tmp
108 setTimeout("refreshImage()", 3000);
115 <body onload=
"init()">
116 <h1 id=
"title">GML Layer Example
</h1>
118 <div id=
"tags"></div>
121 Loads locally stored GML vector data on a basemap. Includes GML example file.
123 <div id=
"image"></div>
124 <div id=
"map" class=
"smallmap"></div>
125 <input type=
"submit" value=
"Reset!" onclick=
"reset()">
126 <input type=
"submit" value=
"Compute!" onclick=
"compute()">