Sygic

Navigation SDK

Back to Sygic

Get POIs in route

Java 3D

This example demonstrates how to find some petrol stations within the driving time interval.
Such a function is typically used to support a rest planning, i.e. this function delivers the set of POIs reachable arround the required rest stop time.
Please note this function is only available with Sygic 3D navigation.

                import com.sygic.sdk.remoteapi.Api;
                import com.sygic.sdk.remoteapi.exception.GeneralException;
                import com.sygic.sdk.remoteapi.model.Poi;
                import com.sygic.sdk.remoteapi.ApiPoi;
                ...
		    	try
		    	{
		    	    int minutes = 90;                     // number of minutes to drive to the planned stop
		    	    int minDriveTime = minutes*60 - 600;  // lower bound driving time in seconds for the POI search
		    	    int maxDriveTime = minutes*60 + 600;  // upper bound driving time in secndds for the POI search
		    	    int maxTime = 0;                      // maximum time function can take, 0 for no time limitation
		    	    ArrayList<PoiOnRoute> pois = ApiPoi.getPoiOnRoute(-1, ApiPoi.PETROL_STATION, minDriveTime, maxDriveTime, maxTime);
                    if (pois.size() > 0)
                    {
		    	       Position pos = pois.get(0).getLocation();
		    	       WayPoint wp = new WayPoint();
		    	       wp.SetLocation(pos.getX(), pos.getY());
		    	       ApiNavigation.startNavigation(wp, 0, false, maxTime);
		    	    }
		    	}
		    	catch (GeneralException e) {
		    		Log.e("PoisOnRoute", "Error code:" + e.getCode());
		    	}