Follow

Creating itinerary example

Description

This sample shows how to create an itinerary with start point, via point and finish point using latitude/longitude parametrization.
Every coordinate needs to be multiplied by 100 000 to be represented with integer value. The API functions used in this sample are AddItinerary and SetRoute to load the itinerary and to start navigation with it.

Java

                import com.sygic.sdk.remoteapi.Api;
                import com.sygic.sdk.remoteapi.ApiItinerary;
                import com.sygic.sdk.remoteapi.exception.GeneralException;
                import com.sygic.sdk.remoteapi.model.StopOffPoint;
                ...
		    	try {
		    	    String strItineraryName = "Itinerary1"; //itinerary name
		    	    int MaxTime = 0;
		    	    int flags = 0;
		    	    ArrayList<StopOffPoint> PointArr = new ArrayList<StopOffPoint>();
		    	    PointArr.add(new StopOffPoint(false, false, StopOffPoint.PointType.START, 1710726, 4814623, -1, 0, "", "ba", ""));
		    	    PointArr.add(new StopOffPoint(false, false, StopOffPoint.PointType.VIAPOINT, 1739716, 4821671, -1, 0, "", "senec", ""));
		    	    PointArr.add(new StopOffPoint(false, false, StopOffPoint.PointType.FINISH, 1759511, 4837351, -1, 0, "", "trnava", ""));
		    	    ApiItinerary.addItinerary(PointArr, strItineraryName, MaxTime);
		    	    ApiItinerary.setRoute(strItineraryName, flags, MaxTime);
		    	} catch (GeneralException e) {
		    		Log.e("Itinerary", "Error code:"+ e.getCode());
		    	}
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

  • Avatar
    Fabio Bursi

    Is there a way to set some waypoints as optional ? I mean if I reach the next waypoint the previuos points are marked as reached.