2012-12-03 74 views
0

我有一個數據庫與點(座標)和標題(方向/方位角)。我想創建指向千米標題方向的餅形扇區(LinearRing)。任何人有任何建議如何使用PHP來構建這個?LinearRing與方向KML

+0

請問您能否指定「餅形扇形」?如何看起來應該是這樣的一個簡單的草圖就好了。其餘的是簡單的幾何... –

+0

我已經上傳了一個手動創建的餅形圖https://docs.google.com/open?id=0B0rMch-nfpzmcE8taU9pb0xJQ00 –

+0

開啓角度是所有的常量/預設值? –

回答

0

好吧,PHP是不是我的實力。這裏是僞代碼,它可以幫助你(*)。 「

」在半徑爲r的球體上,在指定方位角和範圍內的大圓上計算點.PHI,LAMBDA,PHI0,LAMBDA0和AZ是弧度角,RNG是與R具有相同單位的距離「。

INPUT: phi0, lambda0, az, rng, r 
OUTPUT: phi,lambda 

rng = rng/r; // Convert the range to an angle on the sphere (in radians). 

epsilon = 1.7453e-07; // Set tolerance 
if(phi0 >= pi/2 - epsilon) // starting at north pole 
    az = pi; 
if(phi0 <= epsilon - pi/2) // starting at south pole 
    az = 0; 

// Calculate coordinates of great circle end point using spherical trig. 
phi = asin(sin(phi0) * cos(rng) + cos(phi0) * sin(rng) * cos(az)); 

lambda = lambda0 + atan2(sin(rng) * sin(az) , cos(phi0) * cos(rng) - sin(phi0) * sin(rng) * cos(az)); 

phi0 lambda0是你的初始座標和 AZ您的標題。變化 az +/-一定範圍內以獲得點,這些點形成餅的圓段。其餘的應該是直截了當的。

(*)來源:http://mind.cog.jhu.edu/courses/680/octave/Installers/Octave/Octave.OSX10.6/Applications/MATLAB_R2009b.app/toolbox/map/map/private/greatcirclefwd.m