Reputation: 37
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 https://developers.arcgis.com/javascript/3/jsapi/serviceareasolveresult-amd.html
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!
Upvotes: 1
Views: 87
Reputation: 5443
you are correct! As mentined in document serviceAreaPolygons
are already in esri graphic
format.
Well, geometry is a property of the graphic. below is the way to access this.
In your case-
arrayUtils.forEach(solveResult.serviceAreaPolygons,function(serviceArea){
serviceArea.setSymbol(polygonSymbol);
var serviceAreaGeometry = serviceArea.geometry; // this is the geometry. you can use this geometry in your further query.
map.graphics.add(serviceArea);
});
Hoping this will help you.
Feel free to shoot your further queries.
Upvotes: 1