Is there an elegant way to create a CLLocationCoordinate2D object from an array of NSDecimalNumber values? Perhaps a recursive function?
I’m new to objective C and am having difficulty with this.
Below is an example of the data structures I’m working with.
an array of NSDecimalNumber values:
NSLog(@"path: %@", [path description]);
returns
path: (
"-71.4826609644423",
"27.7231737704478",
"-71.4826608497223",
"27.7231120144099",
"-71.4826391681679",
"27.7228678610506",
...
"-71.482414263977",
"27.7225217655116",
)
I can manually create the CLLocationCoordinate2D object like this:
CLLocationCoordinate2D pathCoords[5]={
CLLocationCoordinate2DMake(27.7231737704478,-71.4826609644423),
CLLocationCoordinate2DMake(27.7231120144099,-71.4826608497223),
CLLocationCoordinate2DMake(27.7228678610506,-71.4826391681679),
...
CLLocationCoordinate2DMake(27.7225217655116,-71.482414263977),
};
Any coding suggestions are welcome.
Thanks!
I’m assuming you have already created a
CLLocationCoordinate2Dstructure calledpathCoordsof size 5.The nature of your problem is not recursive, so if you go recursive – it’s an overkill.