Service Area Polygon Geometry

1070
3
03-23-2017 02:37 AM
AlbertoCañivano
New Contributor III

Hi everyone

I  need to get a service area polygon (graphics) for inserting it into a query as geometry. 

This is a piece of code (a serviceAreaTask)

serviceAreaTask.solve(params,function(solveResult){
var polygonSymbol = new SimpleFillSymbol(
"solid",
new SimpleLineSymbol("solid", new Color([232,104,80]), 2),
new Color([232,104,80,0.25])
);
arrayUtils.forEach(solveResult.serviceAreaPolygons, function(serviceArea){
serviceArea.setSymbol(polygonSymbol);
map.graphics.add(serviceArea);

});


According to API ServiceAreaSolveResult | API Reference | ArcGIS API for JavaScript 3.20 

ServiceAreaPolygon is already a graphic, and I can use its geometry in my query

but, I don´t know how I can get this geometry.

Thanks a lot!

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Alberto,

   It should be as simple as

query.geometry = serviceArea.geometry;
thejuskambi
Occasional Contributor III

Are you getting any error? Does the "seriveAreaTask" returns polygon results? If it does, then you have the "serviceArea" graphic which has the geometry property. I am not sure what the problem is. Can you explain a bit more?

0 Kudos
AlbertoCañivano
New Contributor III

I´m use this Api example:

 Basic service area | ArcGIS API for JavaScript 3.20 

I´m using a OSM Network that it works (I´ve already verified it),

I want to improve this example with a Query like "Selection by location" by ArcGis, I think I can use the final geometry of the service area for introducing into query.geometry and show in my table other information depending on I move the slider.

So far, I click a point, fill a table and throw the service area

0 Kudos