为MapKit转换“world file”GIS?

时间:2012-12-23 19:33:36

标签: iphone objective-c ios mapkit gis

我对如何将世界文件转换为左上角和右下角坐标以在MapKit中使用感到困惑。我正试图将NOAA雷达图像放在地图上。

以下是世界文件的示例:

0.0147268399325284
0.000000
0.000000
-0.0147268399325284
-166.284681479714
64.8355168290572

这是所有世界文件的关键:

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

我知道如果我有图片的左上角和右下角(或反之亦然)坐标,我可以在MKMapView上显示它。但我不确定如何在MKMapView上执行world文件,或者如何转换它。任何帮助将不胜感激!

2 个答案:

答案 0 :(得分:3)

第5行和第6行提供的(x,y)坐标不是图像左上角的坐标。这是图像最左上角像素的中心的坐标。给出第1行到第6行的值:

Line 1: x-dimension of a pixel in map units                      = dx
Line 2: rotation parameter                                       
Line 3: rotation parameter
Line 4: NEGATIVE of y-dimension of a pixel in map units          = dy
Line 5: x-coordinate of center of upper left pixel               = centerOfULX
Line 6: y-coordinate of center of upper left pixel               = centerOfULY

您可以按如下方式计算左上角和右下角坐标:

upperLeftX = centerOfULX - dx/2
upperLeftY = centerOfULY + (-dy/2)

lowerRightX = (centerOfULX - dx/2) + imageWidth * dx
lowerRightY = (centerOfUL + (-dy/2)) - imageHeight * (-dy)

答案 1 :(得分:0)

我能够找到方程式,使其进入左上(NW)和右下(SW)lat和long。这是等式。

0.017971305190311 A
0.000000000000000 B
0.000000000000000 C
-0.017971305190311 D
-127.620375523875420 E
50.406626367301044 F

RESOLUTION OF PICTURE 3400 G x 1600 H pixels

CALCULATION:
E + (G*A) = EASTERN POINT
F + (H*D) = SOUTHERN POINT

RESULTS:
Lower left coordinate: 21.652538062803, -127.620375523875420
Upper right coordinate: 50.406626367301044, -66.517937876818