If you've got access to a geometryServer I would suggest using GeometryService.union to combine the geometries of your routes together.Here is an example using the geometry service but it is performing a reshape. I think the main thing you would have to change is to get it to do a union instead that is passed an array of your graphics geometries.
Not tested but this should work:require([ "dojo/_base/array", "esri/map", "esri/layers/GraphicsLayer" ], function(array, Map, GraphicsLayer){ var map = new Map("mapDiv"); var graphics = new GraphicsLayer(); map.addLayer("graphics"); //Create your array here array.forEach(solveResult.routeResults, function(routeResult){ graphics.add(routeResult.route.setSymbol(routeSymbol)); }); });
require([ "dojo/_base/array", "esri/map", "esri/layers/GraphicsLayer" ], function(array, Map, GraphicsLayer){ var map = new Map("mapDiv"); var graphics = new GraphicsLayer(); map.addLayer("graphics"); //Create your array here array.forEach(solveResult.routeResults, function(routeResult){ graphics.add(routeResult.route.setSymbol(routeSymbol)); }); });
I have an array of individual route graphics that I would like to be combined into one graphics layer. I am looking for the best way to do this. Right now I add the routes to the map using map.graphics.add(solveResult.routeResults[0].route.setSymbol(routeSymbol));What would be the best method of combining these routes into one polyline graphics layer? Thanks in advance.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.