Analyze and draw response

3800
12
Jump to solution
05-16-2016 12:53 AM
CloudingSoft
Occasional Contributor

hello I have 2 files with json response service Vehicle Routing Problem, but not analyze this information and draw on the map:

Request URL to return the output routes: http://optimocamino.cloudingsoft.net/tasks/responses/output_routes.js

Request URL to return output orders: http://optimocamino.cloudingsoft.net/tasks/responses/output_orders.js

as it should draw a map from this data?

0 Kudos
1 Solution

Accepted Solutions
TomSellsted
MVP Regular Contributor

Fabien,

I would add a UniqueValueRenderer.  I have updated the previous sample to use a UniqueValueRenderer.

http://gis.yakimawa.gov/demo/optimo.html

Regards,

Tom

View solution in original post

12 Replies
PanagiotisPapadopoulos
Esri Regular Contributor

read this json file and loop through the features.

var saved = dojo.fromJson(data);    esri/geometry/jsonUtils | API Reference | ArcGIS API for JavaScript

for each feature create a graphic

var graphic = new esri.Graphic(saved); 

final push this graphic on a Graphic Layer.

GRAPHICLAYER.add(graphic);

0 Kudos
CloudingSoft
Occasional Contributor

Hi I did so but I still can show the way

http://optimocamino.cloudingsoft.net/tasks/responses/routes.html

I could indicate please I'm wrong?

0 Kudos
TomSellsted
MVP Regular Contributor

Fabien,

Looking at your JSON data, I am not seeing anything resembling geometry.  I see statistics for each vehicle like travel times and distances, but not a polyline geometry that would show the route taken.  Without this geometry, you can't draw anything to the map.  It doesn't look like the JSAPI has a Vehicle Routing Problem module.  You must be doing these on the server.  Be sure to include the geometry on your output to be able to draw it from your results.

Regards,

Tom

0 Kudos
CloudingSoft
Occasional Contributor
0 Kudos
TomSellsted
MVP Regular Contributor

Fabien,

I modified your script to read the results and plot the route lines.  You were on the right track.  The results returned paths instead of a complete polyline that could be plotted.  I created a polyline from each path.  You can look at the results here:

http://gis.yakimawa.gov/demo/optimo.html

Regards,

Tom

CloudingSoft
Occasional Contributor

Hello

in the example it indicates that they are 3 vehicles, as could distinguish colors such routes and put a marker at each stop?

on the other hand I have the "output order" http://optimocamino.cloudingsoft.net/tasks/responses/output_orders.js

what use me this information?

thank you very much!

0 Kudos
TomSellsted
MVP Regular Contributor

Fabien,

I would add a UniqueValueRenderer.  I have updated the previous sample to use a UniqueValueRenderer.

http://gis.yakimawa.gov/demo/optimo.html

Regards,

Tom

CloudingSoft
Occasional Contributor

Hello Tom

on the other hand I have the "output order" http://optimocamino.cloudingsoft.net/tasks/responses/output_orders.js

I understand that here indicates the order of the stops corresponding to each route / vehicle, but do not tell me the coordinates.

as you could add this information to map?

thank you very much!

0 Kudos
TomSellsted
MVP Regular Contributor

Fabien,

Without the coordinates for each stop, they cannot be placed on the map.  I do see that the output orders have distances traveled and you could possibly split the polylines at each of those distances to approximate the stop location.

Regards,

Tom

0 Kudos