Changes between Version 35 and Version 36 of ZooWorkshop/FOSS4GJapan/BuildingWPSClientUsingOL


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

--

Legend:

Unmodified
Added
Removed
Modified
  • ZooWorkshop/FOSS4GJapan/BuildingWPSClientUsingOL

    v35 v36  
    114114
    115115[[Image(OL-JP-2.png,width=500px,nolink,margin: 5)]]
    116 == Calling the single geometry seervices from !JavaScript ==
     116== Calling the single geometry services from !JavaScript ==
    117117
    118118Now 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.
     
    121121#!c
    122122function simpleProcessing(aProcess) {
    123    if (select.features.length == 0)
     123  if (select.features.length == 0)
    124124    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&';
    126128  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!");
    130131    url+='Identifier=Buffer&DataInputs=BufferDistance='+dist+'@datatype=interger;InputPolygon=Reference@xlink:href=';
    131   } else 
    132       url += 'Identifier='+aProcess+'&DataInputs=InputPolygon=Reference@xlink:href=';
    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";
    134135  xlink += '&typename='+control.protocol.featurePrefix;
    135136  xlink += ':'+control.protocol.featureType;
    136137  xlink += '&SRS='+control.protocol.srsName;
    137   xlink += '&FeatureID='+select.features[0].fid;
     138  xlink += '&FeatureID='+parseMapServerId(select.features[0].fid);
    138139  url += encodeURIComponent(xlink);
    139140  url += '&RawDataOutput=Result@mimeType=application/json';
     141 
    140142  var request = new OpenLayers.Request.XMLHttpRequest();
    141143  request.open('GET',url,true);
    142144  request.onreadystatechange = function() {
    143    if(request.readyState == OpenLayers.Request.XMLHttpRequest.DONE) {
     145    if(request.readyState == OpenLayers.Request.XMLHttpRequest.DONE) {
    144146      var GeoJSON = new OpenLayers.Format.GeoJSON();
    145147      var features = GeoJSON.read(request.responseText);
     
    176178Save 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.
    177179
    178 [[Image(OL-3.png,width=500px,nolink,margin: 5)]]
     180[[Image(OL-JP-3.png,width=500px,nolink,margin: 5)]]
    179181== Calling the multiples geometries processes from !JavaScript ==
    180182

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