I am trying to call a geoprocessor from WAB that will clip some tiffs and supply them to the user.
I am passing in a list of boolean and a polygon to clip to.
I am getting the polygon from the dawbox dijit as shown below.
postCreate: function() {
this.inherited(arguments);
this.drawBox.setMap(this.map);
this.drawBox.showClear = true;
this.drawBox.keepOneGraphic = true;
this.own(on(this.drawBox, 'DrawEnd', lang.hitch(this, this._onDrawComplete)));
},
_onDrawComplete: function(graphic) {
var geometry = graphic.geometry;
I then attempted to pass this directly into the geoprocessor which resulted in an error, apparently it needed to be a GPFeatureSet. I got around this error by creating a featureset with my geom in, and passing that to the geoprocessor.
var features = [];
features.push(geometry);
var featureSet = new FeatureSet();
featureSet.features = features;
// setup gp stuff and params
var params = { "BoolList":boollist, "poly": featureSet };
var gp = new Geoprocessor('https://arcgispreprodent.admiralty.co.uk/server/rest/services/Jim/BathyClip/GPServer/BathyClip')
The problem I appear to have now is that poly is always an empty string when I get to the geoprocessor.
If I log poly before I execute the GP it has values, but if I log poly from within the GP its an empty string, the boolean list is passing fine but the poly param is empty.
What do I need to do to pass a polygon to my geoprocessor?
Solved! Go to Solution.
So it seems my error was originated when I extracted the geometry from graphic.
_onDrawComplete: function(graphic) {
var geometry = graphic.geometry;
The FeatureSet expects the entire graphic to be passed in rather than just the geom.
So it seems my error was originated when I extracted the geometry from graphic.
_onDrawComplete: function(graphic) {
var geometry = graphic.geometry;
The FeatureSet expects the entire graphic to be passed in rather than just the geom.