Sending polygon to gp service

1846
1
01-15-2013 08:02 AM
StephenFricke
New Contributor III
Hey everyone,

I have a map service where someone can select a polygon and that selected polygon is sent to a gp service as a clipping extent.  The polygon where the user clicks is made into a graphic, and then that graphic is then sent to the gp service.  The problem is the gp service does not recognize this as a valid clipping extent and the tool fails because of that parameter.  I have tried converting this graphic from web mercator to geographic, and also have tried using the esri.geometry.Polygon(name of graphic) command to try and make it a valid polygon which the gp service can use but I can't seem to get it to work.  Please let me know if you have any idea how to solve this problem.  Thank you for your time!!
0 Kudos
1 Reply
Jay_Gregory
Occasional Contributor III
I have a GP service that takes a user-drawn polygon and uses it as a clipping extent as well.  The actual input the GP service is expecting is a GPFeatureRecordSetLayer, which I got from the DataType field of the parameter in the REST service endpoint. 

I don't know if that is your setup as well, but here is my code to take a graphic and submit it to the gp task:
var features = [];
   features.push(graphic);
   var featureSet = new esri.tasks.FeatureSet();
   featureSet.features = features;
   var params = {"Selecting_Geometry": featureSet, "OutputType": format};
   gp.submitJob(params, completeCallback, statusCallback, function(error){....


Hope that helps!

dugtoni;263832 wrote:
Hey everyone,


I have a map service where someone can select a polygon and that selected polygon is sent to a gp service as a clipping extent.  The polygon where the user clicks is made into a graphic, and then that graphic is then sent to the gp service.  The problem is the gp service does not recognize this as a valid clipping extent and the tool fails because of that parameter.  I have tried converting this graphic from web mercator to geographic, and also have tried using the esri.geometry.Polygon(name of graphic) command to try and make it a valid polygon which the gp service can use but I can't seem to get it to work.  Please let me know if you have any idea how to solve this problem.  Thank you for your time!![/Q
0 Kudos