Creating a new CLLocationCoordinate2D at custom Latitude/Longitude Creating a new CLLocationCoordinate2D at custom Latitude/Longitude ios ios

Creating a new CLLocationCoordinate2D at custom Latitude/Longitude


What made the most sense to you (CLLocationCoordinate2DMake) is correct. You just forgot to include the CoreLocation framework in your project.

And, as others have pointed out, your lat/lon in your file are probably not integers.


what i did was:first create a CLLocationCoordinate2D:

CLLocationCoordinate2D c2D = CLLocationCoordinate2DMake(CLLocationDegrees latitude, CLLocationDegrees longitude); 

my latitude and longitude are double types.

in your Imports be sure Mapkit library is imported.

#import <MapKit/MapKit.h>


This should work.

CLLocationCoordinate2D center;.....else if ([elementName isEqualToString:@"Lat"]) {    center.latitude = [[attributeDict objectForKey:@"degrees"] doubleValue];}else if ([elementName isEqualToString:@"Lon"]) {    center.longitude = [[attributeDict objectForKey:@"degrees"] doubleValue];}