IOS Baidu map track record road fitting
Recently, I am working on a small demo to try track records.
The recording track must be constantly retrieved and recorded to the database.
During the discount, the link will be directly connected at the corner of the road and will not fit with the road. Here I will talk about my solution.
I called the path planning api of Baidu map. In this way, the path fitting function can be realized.
Add dome here: Click to open the link
Note: This dome is running on a real machine and an error will be reported on the simulator. Pay attention when downloading.
For various reasons, images are taken on mobile phones.
Take a look at the previous figure:
VcTHteO1xM/crop + jrMn6s8m1xM/fwrfU2s/Cw + crop "brush: java;">-(void) skip :( BMKRouteSearch *) searcher result :( warn *) result errorCode :( BMKSearchErrorCode) errorThis is the proxy method.
BMKPlanNode * startNode = [[BMKPlanNode alloc] init]; CLLocationCoordinate2D startCoordinate; startCoordinate. latitude = 36.727558; startCoordinate. longpolling = 119.185956; startNode.pt = startCoordinate; BMKPlanNode * endNode = [[BMKPlanNode alloc] init]; CLLocationCoordinate2D endCoordnate; endCoordnate. latitude = 36.827558; endCoordnate. longdesk= 119.385956; endNode.pt = endCoordnate; BMKDrivingRoutePlanOption * drivingRoutePlanOption = [[BMKDrivingRoutePlanOption alloc] init]; drivingRoutePlanOption. from = startNode; drivingRoutePlanOption. to = endNode; if ([_ searcher drivingSearch: drivingRoutePlanOption]) {NSLog (@ "");}
-(Void) onGetDrivingRouteResult :( BMKRouteSearch *) searcher result :( failed *) result errorCode :( BMKSearchErrorCode) error {BMKDrivingRouteLine * plan = (BMKDrivingRouteLine *) [result. routes objectAtIndex: 0]; int size = (int) [plan. steps count]; int pointCount = 0; for (int I = 0; I <size; I ++) {BMKDrivingStep * step = [plan. steps objectAtIndex: I]; pointCount + = step. pointsCount;} BMKMapPoint * points = new BMKMapPoint [pointCount]; int k = 0; for (int I = 0; I <size; I ++) {BMKDrivingStep * step = [plan. steps objectAtIndex: I]; for (int j = 0; j
In the above method, we obtain the road section of the line from the returned line, obtain the points in the road section from the road section, and draw the lines for these points.