Batch Calculations
The batch calculation function calculates the distance and time consumption of the route plan in batches based on the start point and the end point. The final result of the batch calculation service is based on the number of start and end points. If you request 2 starting points and 5 ending points at a time, the final route output is 2*5=10. The sample code is as follows:
// Set the parameters starting point and end point coordinates array GeoPoint[] geoPointStarts=new GeoPoint[]{new GeoPoint(116.34,40.45),new GeoPoint(116.35,40.54)}; GeoPoint[] geoPointEnds=new GeoPoint[]{new GeoPoint(116.45,40.34),new GeoPoint(116.46,40.35)}; //Initiate a request BatchRoutePlan.searchBatchRoute(BatchRoutePlan.Query.newQuery(geoPointStarts, geoPointEnds), new BatchRoutePlan.Listener() { @Override public void onSuccess(final BatchRouteResult result) { // Request success } @Override public void onFail(final APIStatus status) { //Request failed } });
Note 1: The result return interface is an asynchronous thread interface. If the Android project needs to operate the control in the return, it must switch to the Main main thread. Tr Note 2: The batch calculation currently supports up to 100 routes.