2012-12-23 36 views
0

我對如何將世界文件轉換爲左上角和右下角座標以在MapKit中使用有點困惑。我試圖在地圖上放置NOAA雷達圖像。爲MapKit轉換「世界文件」GIS嗎?

這裏是一個世界文件的例子:

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 

我知道,如果我有左上和右下(或副-versa)的圖片座標,我可以在MKMapView上顯示它。但我不確定如何在MKMapView上執行世界文件,或者如何轉換它。任何幫助將不勝感激!

回答

3

第5行和第6行提供的座標(x,y)不是圖像左上邊界的座標。這就是在中心定行1的值image.so的最左上角像素的協調,以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) 
0

我能找到方程式,使其成爲左上角(NW)和右下角(SW)緯度和長度。這是等式。

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