Changes between Version 35 and Version 36 of ZooWorkshop/FOSS4GJapan/BuildingWPSClientUsingOL
- Timestamp:
- Oct 23, 2010, 12:10:44 AM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ZooWorkshop/FOSS4GJapan/BuildingWPSClientUsingOL
v35 v36 114 114 115 115 [[Image(OL-JP-2.png,width=500px,nolink,margin: 5)]] 116 == Calling the single geometry se ervices from !JavaScript ==116 == Calling the single geometry services from !JavaScript == 117 117 118 118 Now that everything is setup, we can go on and call our OGR ZOO services with !JavaScript. Please add the following lines after the {{{init()}}} function, which will call the single geometry processes. … … 121 121 #!c 122 122 function simpleProcessing(aProcess) { 123 123 if (select.features.length == 0) 124 124 return alert("No feature selected!"); 125 var url = '/zoo/?request=Execute&service=WPS&version=1.0.0&'; 125 if(multi.features.length>=1) 126 multi.removeFeatures(multi.features); 127 var url = '/cgi-bin/zoo_loader.cgi?request=Execute&service=WPS&version=1.0.0&'; 126 128 if (aProcess == 'Buffer') { 127 var dist = document.getElementById('bufferDist').value; 128 if (isNaN(dist)) 129 return alert("Distance is not a Number!"); 129 var dist = document.getElementById('bufferDist')?document.getElementById('bufferDist').value:'1'; 130 if (isNaN(dist)) return alert("Distance is not a Number!"); 130 131 url+='Identifier=Buffer&DataInputs=BufferDistance='+dist+'@datatype=interger;InputPolygon=Reference@xlink:href='; 131 } else 132 133 var xlink = control.protocol.url +" ?SERVICE=WFS&REQUEST=GetFeature&VERSION=1.0.0";132 } else 133 url += 'Identifier='+aProcess+'&DataInputs=InputPolygon=Reference@xlink:href='; 134 var xlink = control.protocol.url +"&SERVICE=WFS&REQUEST=GetFeature&VERSION=1.0.0"; 134 135 xlink += '&typename='+control.protocol.featurePrefix; 135 136 xlink += ':'+control.protocol.featureType; 136 137 xlink += '&SRS='+control.protocol.srsName; 137 xlink += '&FeatureID='+ select.features[0].fid;138 xlink += '&FeatureID='+parseMapServerId(select.features[0].fid); 138 139 url += encodeURIComponent(xlink); 139 140 url += '&RawDataOutput=Result@mimeType=application/json'; 141 140 142 var request = new OpenLayers.Request.XMLHttpRequest(); 141 143 request.open('GET',url,true); 142 144 request.onreadystatechange = function() { 143 if(request.readyState == OpenLayers.Request.XMLHttpRequest.DONE) {145 if(request.readyState == OpenLayers.Request.XMLHttpRequest.DONE) { 144 146 var GeoJSON = new OpenLayers.Format.GeoJSON(); 145 147 var features = GeoJSON.read(request.responseText); … … 176 178 Save your HTML file again. You should now be able to select a polygon and to launch a Buffer, !ConvexHull, Boundary or Centroid on it by clicking one of the button. The result of the process should appear as GeoJSON layer on the map, in orange color. 177 179 178 [[Image(OL- 3.png,width=500px,nolink,margin: 5)]]180 [[Image(OL-JP-3.png,width=500px,nolink,margin: 5)]] 179 181 == Calling the multiples geometries processes from !JavaScript == 180 182