Track Correction
Based on the vehicle's GPS data (minimum 10 track points, distance greater than 50 meters), return the basic road information and current road condition information of these track points, and return to the surrounding landmark POI points. The sample code is as follows:
RouteMatch routeMatch=new RouteMatch(); // Set gps data, these values are only used as a reference for usage, specifically still to be obtained through the device RouteMatch.GPSInfo[] gpsInfos=new RouteMatch.GPSInfo[]{ new RouteMatch.GPSInfo(116.324225,39.893390,10.0,0,1,2019526313858L), new RouteMatch.GPSInfo(116.324225,39.893391,10.0,0,1,2019526313858L), new RouteMatch.GPSInfo(116.324225,39.893392,10.0,0,1,2019526313858L), new RouteMatch.GPSInfo(116.324225,39.893393,10.0,0,1,2019526313858L), new RouteMatch.GPSInfo(116.324225,39.893394,10.0,0,1,2019526313858L), new RouteMatch.GPSInfo(116.324225,39.893395,10.0,0,1,2019526313858L), new RouteMatch.GPSInfo(116.324225,39.893396,10.0,0,1,2019526313858L), new RouteMatch.GPSInfo(116.324225,39.893397,10.0,0,1,2019526313858L), new RouteMatch.GPSInfo(116.324225,39.893398,10.0,0,1,2019526313858L), new RouteMatch.GPSInfo(116.324225,39.893399,10.0,0,1,2019526313858L), }; //Setting parameters routeMatch.setQuery(RouteMatch.Query.newQuery("12324",RouteMatchSourceType.PHONE,gpsInfos)); // Set the listener routeMatch.setListener(new RouteMatch.Listener() { @Override public void onSuccess(RouteMatchResult result) { // Request success } @Override public void onFail(APIStatus status) { //Request failed } }); // Initiation of track correction routeMatch.match();
RouteMatch.Query Description:
1. Constructor RouteMatch.Query.newQuery(String guid, String source, GPSInfo[] gpsinfos);
2. parameter guid: id of the device;
3. Parameters source: gps data source type, type value RouteMatchSourceType class constant, as shown below:
Data Source Type | meaning |
---|---|
RouteMatchSourceType.CARNAVI |
Car navigation system |
RouteMatchSourceType.PHONE |
Mobile |
RouteMatchSourceType.SWEAR |
Smart Wearable Device |
4. Parameters gpsinfos: gps data collection.
Note: 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.