| 1 | {{{ |
| 2 | #!html |
| 3 | <!-- Add this in your header --> |
| 4 | <link href="/zoo-demo/css/jquery-ui-1.8.custom.css" rel="stylesheet" type="text/css" /> |
| 5 | <link rel="stylesheet" href="/ZOODEMOREP/spatialtools_files/style_002.css" type="text/css" /> |
| 6 | <link href="/ZOODEMOREP/spatialtools_files/style.css" type="text/css" rel="stylesheet " /> |
| 7 | <script type="text/javascript" src="/openlayers/lib/OpenLayers.js"></script> |
| 8 | <script src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script> |
| 9 | <script type="text/javascript" src="js/jquery-1.3.2.js"></script> |
| 10 | <script type="text/javascript"> |
| 11 | var map, SubwayStops, layer; |
| 12 | |
| 13 | function init(){ |
| 14 | OpenLayers.ProxyHost= "../cgi-bin/proxy_zoo.cgi?url="; |
| 15 | map = new OpenLayers.Map('map', { |
| 16 | controls: [ |
| 17 | new OpenLayers.Control.PanZoom(), |
| 18 | new OpenLayers.Control.Permalink(), |
| 19 | new OpenLayers.Control.LayerSwitcher(), |
| 20 | new OpenLayers.Control.Navigation() |
| 21 | ], |
| 22 | maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34), |
| 23 | maxResolution: 156543.0399, |
| 24 | numZoomLevels: 19, |
| 25 | units: "m", |
| 26 | projection: new OpenLayers.Projection("EPSG:900913"), |
| 27 | displayProjection: new OpenLayers.Projection("EPSG:4326") |
| 28 | }); |
| 29 | |
| 30 | var layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik"); |
| 31 | map.addLayer(layerMapnik); |
| 32 | |
| 33 | layer = new OpenLayers.Layer.Vector("Voronoi",{ |
| 34 | styleMap: new OpenLayers.StyleMap({ |
| 35 | strokeColor: "#000000", |
| 36 | strokeWidth: 1 |
| 37 | }) |
| 38 | }); |
| 39 | map.addLayer(layer); |
| 40 | |
| 41 | SubwayStops = new OpenLayers.Layer.GML("Subway stops", |
| 42 | "http://www.zoo-project.org/data-srtm/stations.gml", { |
| 43 | format: OpenLayers.Format.GML, |
| 44 | styleMap: new OpenLayers.StyleMap({ |
| 45 | pointRadius: 3, |
| 46 | fillColor: "#ee2200", |
| 47 | fillOpacity: 1, |
| 48 | strokeColor: "#ee9900", |
| 49 | strokeWidth: 1 |
| 50 | }), |
| 51 | visibility: true |
| 52 | }); |
| 53 | map.addLayer(SubwayStops); |
| 54 | |
| 55 | map.zoomToExtent(new OpenLayers.Bounds(240047.557702813,6234682.54296228,281304.353234602,6267347.78149257),true); |
| 56 | } |
| 57 | function cgalProcessing(aProcess) { |
| 58 | var url = '/zoo/?request=Execute&service=WPS&version=1.0.0&'; |
| 59 | if (aProcess == 'voronoi') |
| 60 | url += 'Identifier=Voronoi&DataInputs=InputPoints=Reference@xlink:href='; |
| 61 | else |
| 62 | url += 'Identifier='+aProcess+'&DataInputs=InputPoints=Reference@xlink:href='; |
| 63 | |
| 64 | var xlink = SubwayStops.url; |
| 65 | url += encodeURIComponent(xlink); |
| 66 | url += '&RawDataOutput=Result'; |
| 67 | |
| 68 | var request = new OpenLayers.Request.XMLHttpRequest(); |
| 69 | request.open('GET',url,true); |
| 70 | request.onreadystatechange = function() { |
| 71 | if(request.readyState == OpenLayers.Request.XMLHttpRequest.DONE) { |
| 72 | var GeoJSON = new OpenLayers.Format.GeoJSON(); |
| 73 | var features = GeoJSON.read(request.responseText); |
| 74 | layer.removeFeatures(layer.features); |
| 75 | layer.addFeatures(features); |
| 76 | } |
| 77 | } |
| 78 | request.send(); |
| 79 | } |
| 80 | </script> |
| 81 | |
| 82 | }}} |