Changes between Version 37 and Version 38 of ZooWorkshop/FOSS4GJapan/BuildingWPSClientUsingOL


Ignore:
Timestamp:
Oct 23, 2010, 12:13:19 AM (14 years ago)
Author:
djay
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ZooWorkshop/FOSS4GJapan/BuildingWPSClientUsingOL

    v37 v38  
    188188#!js
    189189function multiProcessing(aProcess) {
    190  if (select.features.length == 0 || hover.features.length == 0)
    191    return alert("No feature created!");
    192  var url = '/zoo/';
    193  var xlink = control.protocol.url +"?SERVICE=WFS&REQUEST=GetFeature&VERSION=1.0.0";
    194  xlink += '&typename='+control.protocol.featurePrefix;
    195  xlink += ':'+control.protocol.featureType;
    196  xlink += '&SRS='+control.protocol.srsName;
    197  xlink += '&FeatureID='+select.features[0].fid;
    198  var GeoJSON = new OpenLayers.Format.GeoJSON();
    199  try {
     190  if (select.features.length == 0 || hover.features.length == 0)
     191    return alert("No feature created!");
     192  var url = '/cgi-bin/zoo_loader.cgi';
     193  var xlink = control.protocol.url +"&SERVICE=WFS&REQUEST=GetFeature&VERSION=1.0.0";
     194  xlink += '&typename='+control.protocol.featurePrefix;
     195  xlink += ':'+control.protocol.featureType;
     196  xlink += '&SRS='+control.protocol.srsName;
     197  xlink += '&FeatureID='+parseMapServerId(select.features[0].fid);
     198  var GeoJSON = new OpenLayers.Format.GeoJSON();
     199  try {
    200200    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">';
    201     params += ' <ows:Identifier>'+aProcess+'</ows:Identifier>';
    202     params += ' <wps:DataInputs>';
    203     params += ' <wps:Input>';
    204     params += ' <ows:Identifier>InputEntity1</ows:Identifier>';
    205     params += ' <wps:Reference xlink:href="'+xlink.replace(/&/gi,'&amp;')+'"/>';
    206     params += ' </wps:Input>';
    207     params += ' <wps:Input>';
    208     params += ' <ows:Identifier>InputEntity2</ows:Identifier>';
    209     params += ' <wps:Data>';
    210     params += ' <wps:ComplexData mimeType="application/json"> '+GeoJSON.write(hover.features[0].geometry)+' </wps:ComplexData>';
    211     params += ' </wps:Data>';
    212     params += ' </wps:Input>';
    213     params += ' </wps:DataInputs>';
    214     params += ' <wps:ResponseForm>';
    215     params += ' <wps:RawDataOutput>';
    216     params += ' <ows:Identifier>Result</ows:Identifier>';
    217     params += ' </wps:RawDataOutput>';
    218     params += ' </wps:ResponseForm>';
    219     params += ' </wps:Execute>';
    220  } catch(e) {
     201    params += '<ows:Identifier>'+aProcess+'</ows:Identifier>';
     202    params += '<wps:DataInputs>';
     203    params += '<wps:Input>';
     204    params += '<ows:Identifier>InputEntity1</ows:Identifier>';
     205    params += '<wps:Reference xlink:href="'+xlink.replace(/&/gi,'&amp;')+'"/>';
     206    params += '</wps:Input>';
     207    params += '<wps:Input>';
     208    params += '<ows:Identifier>InputEntity2</ows:Identifier>';
     209    params += '<wps:Data>';
     210    params += '<wps:ComplexData mimeType="application/json"> '+GeoJSON.write(hover.features[0].geometry)+' </wps:ComplexData>';
     211    params += '</wps:Data>';
     212    params += '</wps:Input>';
     213    params += '</wps:DataInputs>';
     214    params += '<wps:ResponseForm>';
     215    params += '<wps:RawDataOutput>';
     216    params += '<ows:Identifier>Result</ows:Identifier>';
     217    params += '</wps:RawDataOutput>';
     218    params += '</wps:ResponseForm>';
     219    params += '</wps:Execute>';
     220  } catch(e) {
    221221    alert(e);
    222222    return false;
    223  }
    224  var request = new OpenLayers.Request.XMLHttpRequest();
    225  request.open('POST',url,true);
    226  request.setRequestHeader('Content-Type','text/xml');
    227  request.onreadystatechange = function() {
    228    if(request.readyState == OpenLayers.Request.XMLHttpRequest.DONE) {
    229      var GeoJSON = new OpenLayers.Format.GeoJSON();
    230      var features = GeoJSON.read(request.responseText);
    231      multi.removeFeatures(multi.features);
    232      multi.addFeatures(features);
    233    }
    234  }
    235  request.send(params);
     223  }
     224  var request = new OpenLayers.Request.XMLHttpRequest();
     225  request.open('POST',url,true);
     226  request.setRequestHeader('Content-Type','text/xml');
     227  request.onreadystatechange = function() {
     228    if(request.readyState == OpenLayers.Request.XMLHttpRequest.DONE) {
     229      var GeoJSON = new OpenLayers.Format.GeoJSON();
     230      var features = GeoJSON.read(request.responseText);
     231      multi.removeFeatures(multi.features);
     232      multi.addFeatures(features);
     233    }
     234  }
     235  request.send(params);
    236236}
    237237}}}

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png