Quote:
Originally Posted by TelTikky
I am converting valid CLLocationCoordinate2D into MKMapPoint like this:
Code:
CLLocationCoordinate2D currentLocation = {finalLat, finalLong};
MKMapPoint point = MKMapPointForCoordinate(currentLocation);
printf("-----*=====*-----Lat is: %f, Lng is: %f----*----*----\n",point.x,point.y);
But on the console this get printed out:
-----*=====*-----Lat is: 246894703.702471, Lng is: 160935825.940386----*----*----
In the above example:
finalLat = 33.7035830
finalLong = 151.1198290
What have I done wrong?
|
Nothing.
The x and y positions of a map point are not lat and long. You need to use the function MKCoordinateForMapPoint() to get the lat/long of a map point.
I believe the x/y of a map point tell you the coordinates of the point in pixels, as if the entire world was one big grid of pixels. It might be miles across at the current zoom level, and only a small portion of it would be visible in the map view.
All this information is in the docs. When you're getting a result you don't understand, it pays to slow down and go read the Apple documentation. It's quite good for the most part.