I’m a little confused on how to convert a world file to upper left and lower right coordinates to use in MapKit. I’m trying to put an NOAA radar image on top of a map.
Here’s an example of a world file:
0.0147268399325284
0.000000
0.000000
-0.0147268399325284
-166.284681479714
64.8355168290572
and here’s the key to all world files:
Line 1: x-dimension of a pixel in map units
Line 2: rotation parameter
Line 3: rotation parameter
Line 4: NEGATIVE of y-dimension of a pixel in map units
Line 5: x-coordinate of center of upper left pixel
Line 6: y-coordinate of center of upper left pixel
I know that if I have the upper left and lower right (or vice-versa) coordinates of the picture, I would be able to display it on an MKMapView. But I’m unsure on how to execute the world file on an MKMapView, or how to convert it. Any help would be greatly appreciated!
the (x,y) coordinate provided at line 5 and 6 is not the coordinate of upper left bound of the image. that’s the coordinate of the center of most upper left pixel of the image.so given the values of line 1 to 6:
you can compute the upper left and lower right coordinates as follow: