Drawing routes using latitude and longitude values ​​stored in the database

I created a table in a database called UserJourneyLocation, consisting of the columns LocationID, Latitude, Longitude. Latitude and longitude values ​​are stored in the sqlite database. I want to get these latitude and longitude values ​​that are in the sqlite database and this is displayed on the map and the route of the rally, which displays the starting location and destination. Please help me in solving this problem. thank

+2
source share
2 answers

try the following: -

NSString *urlstring=[NSString stringWithFormat:@"http://maps.google.com/?saddr=%f,%f&daddr=%f,%f",sourcelocation.latitude,sourcelocation.longitude,destinationlocation.latitude,destinationlocation.longitude];
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:urlstring]];

google, . - , . , .

0

: iOS 4.0 +

CLLocationCoordinate2D  points[2]; // how many points you have saved


points[0] = CLLocationCoordinate2DMake(52.3, 9.7); // you can for loop initializing, i made it so for simplicity :)

points[1] = CLLocationCoordinate2DMake(52.37, 9.74);



MKPolyline* ret = [MKPolyline polylineWithCoordinates:points count:2];

mapView

0

All Articles