| | 39 | == XML POST Request on page 22 == |
| | 40 | |
| | 41 | {{{ |
| | 42 | #!xml |
| | 43 | <wps:Execute service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net /wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 ../wpsExecute_request.xsd"> |
| | 44 | <ows:Identifier>Boundary</ows:Identifier> |
| | 45 | <wps:DataInputs> |
| | 46 | <wps:Input> |
| | 47 | <ows:Identifier>InputPolygon</ows:Identifier> |
| | 48 | <ows:Title>Playground area</ows:Title> |
| | 49 | <wps:Reference xlink:href="http://localhost:8082/geoserver/ows/?SERVICE=WFS&REQUEST=GetFeature&VERSION=1.0.0&typename=topp:states&SRS=EPSG:4326&FeatureID=states.15"/> |
| | 50 | </wps:Input> |
| | 51 | </wps:DataInputs> |
| | 52 | <wps:ResponseForm> |
| | 53 | <wps:ResponseDocument> |
| | 54 | <wps:Output> |
| | 55 | <ows:Identifier>Result</ows:Identifier> |
| | 56 | <ows:Title>Area serviced by playground.</ows:Title> |
| | 57 | <ows:Abstract>Area within which most users of this playground will live.</ows:Abstract> |
| | 58 | </wps:Output> |
| | 59 | </wps:ResponseDocument> |
| | 60 | </wps:ResponseForm> |
| | 61 | </wps:Execute> |
| | 62 | }}} |
| | 63 | |
| | 64 | == XML POST Request on page 23 == |
| | 65 | |
| | 66 | {{{ |
| | 67 | #!xml |
| | 68 | <wps:Execute service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 ../wpsExecute_request.xsda"> |
| | 69 | <ows:Identifier>Boundary</ows:Identifier> |
| | 70 | <wps:DataInputs> |
| | 71 | <wps:Input> |
| | 72 | <ows:Identifier>InputPolygon</ows:Identifier> |
| | 73 | <wps:Data> |
| | 74 | <wps:ComplexData mimeType="application/json"> |
| | 75 | { "type": "MultiPolygon", "coordinates": [ [ [ [ -105.998360, 31.393818 ], [ -106.212753, 31.478128 ], [ -106.383041, 31.733763 ], [ -106.538971, 31.786198 ], [-106.614441, 31.817728 ], [ -105.769730, 31.170780 ], [ -105.998360, 31.393818 ] ] ], [ [ [-94.913429, 29.257572 ], [ -94.767380, 29.342451 ], [ -94.748405, 29.319490 ], [-95.105415, 29.096958 ], [ -94.913429, 29.257572 ] ] ] ] } |
| | 76 | </wps:ComplexData> |
| | 77 | </wps:Data> |
| | 78 | </wps:Input> |
| | 79 | </wps:DataInputs> |
| | 80 | <wps:ResponseForm> |
| | 81 | <wps:ResponseDocument> |
| | 82 | <wps:Output> |
| | 83 | <ows:Identifier>Result</ows:Identifier> |
| | 84 | <ows:Title>Area serviced by playground.</ows:Title> |
| | 85 | <ows:Abstract>Area within which most users of this |
| | 86 | playground will live.</ows:Abstract> |
| | 87 | </wps:Output> |
| | 88 | </wps:ResponseDocument> |
| | 89 | </wps:ResponseForm> |
| | 90 | </wps:Execute> |
| | 91 | }}} |
| | 92 | |
| | 170 | |
| | 171 | == Part 4.4 Page 35 code section == |
| | 172 | |
| | 173 | {{{ |
| | 174 | function multiProcessing(aProcess) { |
| | 175 | if (select.features.length == 0 || hover.features.length == 0) |
| | 176 | return alert("No feature created!"); |
| | 177 | var url = '/zoo/'; |
| | 178 | var xlink = control.protocol.url +"?SERVICE=WFS&REQUEST=GetFeature&VERSION=1.0.0"; |
| | 179 | xlink += '&typename='+control.protocol.featurePrefix; |
| | 180 | xlink += ':'+control.protocol.featureType; |
| | 181 | xlink += '&SRS='+control.protocol.srsName; |
| | 182 | xlink += '&FeatureID='+select.features[0].fid; |
| | 183 | var GeoJSON = new OpenLayers.Format.GeoJSON(); |
| | 184 | try { |
| | 185 | var params = '<wps:Execute service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0/../wpsExecute_request.xsd">'; |
| | 186 | params += ' <ows:Identifier>'+aProcess+'</ows:Identifier>'; |
| | 187 | params += ' <wps:DataInputs>'; |
| | 188 | params += ' <wps:Input>'; |
| | 189 | params += ' <ows:Identifier>InputEntity1</ows:Identifier>'; |
| | 190 | params += ' <wps:Reference xlink:href="'+xlink.replace(/&/gi,'&')+'"/>'; |
| | 191 | params += ' </wps:Input>'; |
| | 192 | params += ' <wps:Input>'; |
| | 193 | params += ' <ows:Identifier>InputEntity2</ows:Identifier>'; |
| | 194 | params += ' <wps:Data>'; |
| | 195 | params += ' <wps:ComplexData mimeType="application/json"> '+GeoJSON.write(hover.features[0].geometry)+' </wps:ComplexData>'; |
| | 196 | params += ' </wps:Data>'; |
| | 197 | params += ' </wps:Input>'; |
| | 198 | params += ' </wps:DataInputs>'; |
| | 199 | params += ' <wps:ResponseForm>'; |
| | 200 | params += ' <wps:RawDataOutput>'; |
| | 201 | params += ' <ows:Identifier>Result</ows:Identifier>'; |
| | 202 | params += ' </wps:RawDataOutput>'; |
| | 203 | params += ' </wps:ResponseForm>'; |
| | 204 | params += ' </wps:Execute>'; |
| | 205 | } catch(e) { |
| | 206 | alert(e); |
| | 207 | return false; |
| | 208 | } |
| | 209 | var request = new OpenLayers.Request.XMLHttpRequest(); |
| | 210 | request.open('POST',url,true); |
| | 211 | request.setRequestHeader('Content-Type','text/xml'); |
| | 212 | request.onreadystatechange = function() { |
| | 213 | if(request.readyState == OpenLayers.Request.XMLHttpRequest.DONE) { |
| | 214 | var GeoJSON = new OpenLayers.Format.GeoJSON(); |
| | 215 | var features = GeoJSON.read(request.responseText); |
| | 216 | multi.removeFeatures(multi.features); |
| | 217 | multi.addFeatures(features); |
| | 218 | } |
| | 219 | } |
| | 220 | request.send(params); |
| | 221 | } |
| | 222 | |
| | 223 | }}} |