Ich habe ein Python -Skript unten, das Ergebnis zu rad liefert, das ich dann in Grad umwandelte. Es funktioniert gut, aber ich bin interessiert, die gleiche Funktion in SQL zu erstellen, damit ich sie in der Tabelle an Parse ECEF -Werten verwenden kann. < /P>
import math
def xyz2llh(x,y,z):
'''
Function to convert xyz ECEF to llh
convert cartesian coordinate into geographic coordinate
ellipsoid definition: WGS84
a= 6,378,137m
f= 1/298.257
Input
x: coordinate X meters
y: coordinate y meters
z: coordinate z meters
Output
lat: latitude rad
lon: longitude rad
h: height meters
'''
# --- WGS84 constants
a = 6378137.0
f = 1.0 / 298.257223563
# --- derived constants
b = a - f*a
e = math.sqrt(math.pow(a,2.0)-math.pow(b,2.0))/a
clambda = math.atan2(y,x)
p = math.sqrt(pow(x,2.0)+pow(y,2))
h_old = 0.0
# first guess with h=0 meters
theta = math.atan2(z,p*(1.0-math.pow(e,2.0)))
cs = math.cos(theta)
sn = math.sin(theta)
N = math.pow(a,2.0)/math.sqrt(math.pow(a*cs,2.0)+math.pow(b*sn,2.0))
h = p/cs - N
while abs(h-h_old) > 1.0e-6:
h_old = h
theta = math.atan2(z,p*(1.0-math.pow(e,2.0)*N/(N+h)))
cs = math.cos(theta)
sn = math.sin(theta)
N = math.pow(a,2.0)/math.sqrt(math.pow(a*cs,2.0)+math.pow(b*sn,2.0))
h = p/cs - N
llh = {'lon':clambda, 'lat':theta, 'height': h}
return llh
Ich habe ein Python -Skript unten, das Ergebnis zu rad liefert, das ich dann in Grad umwandelte. Es funktioniert gut, aber ich bin interessiert, die gleiche Funktion in SQL zu erstellen, damit ich sie in der Tabelle an Parse ECEF -Werten verwenden kann. < /P> [code]import math def xyz2llh(x,y,z): ''' Function to convert xyz ECEF to llh convert cartesian coordinate into geographic coordinate ellipsoid definition: WGS84 a= 6,378,137m f= 1/298.257
Input x: coordinate X meters y: coordinate y meters z: coordinate z meters Output lat: latitude rad lon: longitude rad h: height meters ''' # --- WGS84 constants a = 6378137.0 f = 1.0 / 298.257223563 # --- derived constants b = a - f*a e = math.sqrt(math.pow(a,2.0)-math.pow(b,2.0))/a clambda = math.atan2(y,x) p = math.sqrt(pow(x,2.0)+pow(y,2)) h_old = 0.0 # first guess with h=0 meters theta = math.atan2(z,p*(1.0-math.pow(e,2.0))) cs = math.cos(theta) sn = math.sin(theta) N = math.pow(a,2.0)/math.sqrt(math.pow(a*cs,2.0)+math.pow(b*sn,2.0)) h = p/cs - N while abs(h-h_old) > 1.0e-6: h_old = h theta = math.atan2(z,p*(1.0-math.pow(e,2.0)*N/(N+h))) cs = math.cos(theta) sn = math.sin(theta) N = math.pow(a,2.0)/math.sqrt(math.pow(a*cs,2.0)+math.pow(b*sn,2.0)) h = p/cs - N llh = {'lon':clambda, 'lat':theta, 'height': h} return llh [/code]
Ich suche nach einer sehr schnellen Möglichkeit, einen großen String in eine Ganzzahl umzuwandeln. Die int-Funktion ist für die Zeichenfolge, die ich konvertieren möchte, sehr langsam – ich habe...
Ich schreibe einen DSP-Code, der eine Wellenfaltungsverzerrung an einem Eingangssignal durchführt. Dieser Code wendet eine Amplitudenverstärkung an (multipliziert die Eingabe mit einem...
Die Shopify-Vorlage „Refresh“ ist gut gemacht und sehr gut für die Anforderungen geeignet. Ich müsste die Website ohne die gesamte Shopify-Integration erstellen und versuche, die manuelle...
Ich habe eine Methode, die einen Unschärfeneffekt auf ein Bitmapimage anwendet, und ich möchte dieses Bild (als PNG) auf der Festplatte speichern. Ich habe alle möglichen Tricks ausprobiert, damit es...