Hey i succesfully convert longitude&latitude to x/y coordinates by using this formula:
// These should roughly box Germany - use the actual values appropriate to your image
double minLat = 54.8;
double minLong = 5.5;
double maxLat = 47.2;
double maxLong = 15.1;
// Map image size (in points)
CGSize mapSize = mapView.frame.size;
// Determine the map scale (points per degree)
double xScale = mapSize.width / (maxLong - minLong);
double yScale = mapSize.height / (maxLat - minLat);
// Latitude and longitude of city
double spotLat = 49.993615;
double spotLong = 8.242493;
// position of map image for point
CGFloat x = (spotLong - minLong) * xScale;
CGFloat y - (spotLat - minLat) * yScale;
But now i need to convert it the other way. Lets say i got x = 83 and y = 294. How can i get the latitude & longitude from that ?
Thanks
IF…
Then…
Just rearrange the equation surely?
Then do the same with y for the Latitude.