AnsweredAssumed Answered

prepare url

Question asked by CloudingSoft on Apr 23, 2016
Latest reply on Apr 23, 2016 by CloudingSoft

Hello

I'm working with "Vehicle Routing Problem service"

http://resources.arcgis.com/en/help/arcgis-rest-api/#/Vehicle_Routing_Problem_service/02r3000000n4000000/

 

 

y no puedo reproducir el ejemplo PHP  de esta manera: "Servicing a set of orders with a fleet of vehicles"

 

$token = "my_token";

$jsonData  = '&orders={"features":[{"geometry":{"x":-122.51,"y":37.7724},"attributes":{"DeliveryQuantities":1706,"Name":"Store_1","ServiceTime":25,"TimeWindowStart1":1355245200000,"TimeWindowEnd1":1355274000000,"MaxViolationTime1":0}},{"geometry":{"x":-122.4889,"y":37.7538},"attributes":{"DeliveryQuantities":1533,"Name":"Store_2","ServiceTime":23,"TimeWindowStart1":1355245200000,"TimeWindowEnd1":1355274000000,"MaxViolationTime1":0}},{"geometry":{"x":-122.4649,"y":37.7747},"attributes":{"DeliveryQuantities":1580,"Name":"Store_3","ServiceTime":24,"TimeWindowStart1":1355245200000,"TimeWindowEnd1":1355274000000,"MaxViolationTime1":0}},{"geometry":{"x":-122.4739,"y":37.7432},"attributes":{"DeliveryQuantities":1289,"Name":"Store_4","ServiceTime":20,"TimeWindowStart1":1355245200000,"TimeWindowEnd1":1355274000000,"MaxViolationTime1":0}},{"geometry":{"x":-122.4493,"y":37.7315},"attributes":{"DeliveryQuantities":1302,"Name":"Store_5","ServiceTime":21,"TimeWindowStart1":1355245200000,"TimeWindowEnd1":1355274000000,"MaxViolationTime1":0}},{"geometry":{"x":-122.4917,"y":37.6493},"attributes":{"DeliveryQuantities":1775,"Name":"Store_6","ServiceTime":26,"TimeWindowStart1":1355245200000,"TimeWindowEnd1":1355274000000,"MaxViolationTime1":0}},{"geometry":{"x":-122.4832,"y":37.7012},"attributes":{"DeliveryQuantities":1014,"Name":"Store_7","ServiceTime":17,"TimeWindowStart1":1355245200000,"TimeWindowEnd1":1355274000000,"MaxViolationTime1":0}},{"geometry":{"x":-122.5301,"y":37.8935},"attributes":{"DeliveryQuantities":1761,"Name":"Store_8","ServiceTime":26,"TimeWindowStart1":1355245200000,"TimeWindowEnd1":1355274000000,"MaxViolationTime1":0}},{"geometry":{"x":-122.2875,"y":37.8909},"attributes":{"DeliveryQuantities":1815,"Name":"Store_9","ServiceTime":27,"TimeWindowStart1":1355245200000,"TimeWindowEnd1":1355274000000,"MaxViolationTime1":0}}]}';

$jsonData .= '&depots={"features":[{"geometry":{"x":-122.3943,"y":37.7967},"attributes":{"Name":"San Francisco","TimeWindowStart1":1355241600000,"TimeWindowEnd1":1355274000000}}]}';

$jsonData .= '&routes={"features":[{"attributes":{"Name":"Truck_1","StartDepotName":"San Francisco","EndDepotName":"San Francisco","StartDepotServiceTime":60,"EarliestStartTime":1355241600000,"LatestStartTime":1355241600000,"Capacities":"15000","CostPerUnitTime":0.2,"CostPerUnitDistance":1.5,"MaxOrderCount":2,"MaxTotalTime":360,"MaxTotalTravelTime":120,"MaxTotalDistance":80}},{"attributes":{"Name":"Truck_2","StartDepotName":"San Francisco","EndDepotName":"San Francisco","StartDepotServiceTime":60,"EarliestStartTime":1355241600000,"LatestStartTime":1355241600000,"Capacities":"15000","CostPerUnitTime":0.2,"CostPerUnitDistance":1.5,"MaxOrderCount":2,"MaxTotalTime":360,"MaxTotalTravelTime":120,"MaxTotalDistance":80}},{"attributes":{"Name":"Truck_3","StartDepotName":"San Francisco","EndDepotName":"San Francisco","StartDepotServiceTime":60,"EarliestStartTime":1355241600000,"LatestStartTime":1355241600000,"Capacities":"15000","CostPerUnitTime":0.2,"CostPerUnitDistance":1.5,"MaxOrderCount":2,"MaxTotalTime":360,"MaxTotalTravelTime":120,"MaxTotalDistance":80}}]}';

 

$url = 'https://logistics.arcgis.com/arcgis/rest/services/World/VehicleRoutingProblem/GPServer/SolveVehicleRoutingProblem/submitJob?token='.$token.'&time_units=Minutes&distance_units=Miles&uturn_policy=NO_UTURNS&populate_directions=true&directions_language=en&default_date=1355212800000&f=json' . $jsonData;

 

$app_info = file_get_contents($url);

 

echo '<pre>';

var_dump($app_info); //RETURN FALSE

echo '</pre>';

this return Warning: file_get_contents(https://logistics.arcgis.com/arcgis/rest/services/World/VehicleRoutingProblem/GPServer/SolveVehicleRoutingProblem/submitJob?token....

Outcomes