Geo-processing result returning zero result

743
7
11-09-2017 07:56 AM
akshayloya
Occasional Contributor II

I have developed a geoprocessing service as below.

I'm then consuming it in web app builder with following code:

var lineSymbolQuery = new SimpleLineSymbol(
SimpleLineSymbol.STYLE_DASH,
new Color([255, 0, 0]),
3);
this.geometryService = new GeometryService(this.config.queryLayer.geomService);
var params1 = new ProjectParameters();
params1.geometries = [result.features["1"].geometry];
var outSR1 = new esri.SpatialReference({ wkid: 32646 });     ///because my data is in this spatial reference 
params1.outSR = outSR1;
this.geometryService.project(params1, lang.hitch(this, function (projectedPoints) {
projectedPoints;
LARService.setOutSpatialReference(outSR1);
/*var inputProfileGraphic = new Graphic(result.features["0"].geometry, null, {
OID: 1
});*/
var clickPointGraphic = new Graphic(result.features["0"].geometry, lineSymbolQuery);

var inputLineFeatures = new FeatureSet();
inputLineFeatures.features = [clickPointGraphic];
var params = {
"Route": inputLineFeatures
};

LARService.execute({
params
}).then(lang.hitch(this, function (results) {
results;
}));
 
This model works completely fine on ArcMap but I get a null result when I execute through web app builder. Can someone please help me understand where I'm going wrong. 
Thanks in advance. 
Tags (1)
0 Kudos
7 Replies
RobertScheitlin__GISP
MVP Emeritus

Akshay,

You have:

this.geometryService.project(params1, lang.hitch(this, function (projectedPoints) {

So the results of the project are called projectedPoints but you are latter in your code using:

var clickPointGraphic = new Graphic(result.features["0"].geometry, lineSymbolQuery);

I am not sure where result.features["0"].geometry is coming from in your code...

0 Kudos
akshayloya
Occasional Contributor II

Hi Robert,

I was trying with another coordinate system but anyway it doesn't have any impact on the result. I still get 0 features as result. 

and result.features[0].geometry  is my result which I getting from fetching route data using query. I'm passing this to my GP service for the Parameter value. 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Akshay,

  So is the input geometry a point or a polyline? When it works in ArcMap what is the spatial reference of the input geometry? I don't like helping on GP widget stuff because people normally say it works in ArcMap but not in X. Well there are many things that would possibly prevent it from working in Xand yet work in ArcMap just fine. There is the whole scratch workspace thing and several others. But is could just be that you are just not getting the input param correct.

0 Kudos
akshayloya
Occasional Contributor II

Hi Robert, 

I understand the pain. Sorry for that name confusion. It is a polyline. 

Secondly, I have just one param which is a result set for that I'm simply passing my result from a query as mentioned above and spatial reference is the same as my data, so I don't see a problem there. 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Akshay,

  So I don't see the issue either then. Does the GP create a featureclass or anything server side? Have you checked the server logs for clues as to what is going wrong?

0 Kudos
akshayloya
Occasional Contributor II

It returns a table and a feature class. No warnings or issues in the logs. I'd checked that. 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Did you change the server log to verbose or detailed?

0 Kudos