Mengenai javascript ke SQL, ini mungkin cara Anda mengatasinya:
SELECT FromX,
FromY,
CASE WHEN FromX > 180 THEN NULL ELSE FromX * 0.017453292519943295 * 6378137.0 END AS mercatorX_lon2,
CASE WHEN FromY > 90 THEN NULL ELSE 3189068.5 * LOG((1.0 + SIN(FromY * 0.017453292519943295)) / (1.0 - SIN(FromY * 0.017453292519943295))) END AS mercatorY_lat2
FROM TABLENAME
Saya pikir yang berikut ini akan menjawab pertanyaan pertama Anda. Ini akan membutuhkan sedikit pengecekan kesalahan. Untuk membantu, Anda dapat menemukan persamaan aslinya di sini: http://www.colorado.edu/geography/gcraft/notes/datum/gif/molodens.gif
--fromTheta :column --radians
--fromLamda :column --radians
--fromH :column --meters
DECLARE @fromA float = 6378206.4 --radius of earth, meters
DECLARE @fromF float =1.0/294.9786982 --Flattening
DECLARE @toA float =6378137.0 --radius of earth, meters
DECLARE @toF float = 1.0/298.257223563 --Flattening
DECLARE @dA float = @toA - @fromA --change in equatorial radius
DECLARE @dX float = -8.0 --change in X, meters
DECLARE @dY float = 160.0 --change in Y, meters
DECLARE @dZ float = 176.0 --change in Z, meters
DECLARE @dF float = @toF-@fromF --change in flattening
DECLARE @fromES float = 2.0*@fromF - @fromF*@fromF --first eccentricity squared
DECLARE @bda float = 1.0-@fromF --polar radius divided by equatorial radius
--RM = (@fromA*(1-@fromES)/POWER(1-@fromES*sin(fromTheta)*sin(fromTheta), 1.5))
--RN = (@fromA/SQRT(1.00-@fromES*sin(fromTheta)*sin(fromTheta)))
SELECT
((((-@dX*sin(fromTheta)*cos(fromLamda)-@dY*sin(fromTheta)*sin(fromLamda))+@dZ*cos(fromTheta))+@dA*(@fromA/SQRT(1.00-@fromES*sin(fromTheta)*sin(fromTheta)))*@fromES*sin(fromTheta)*cos(fromTheta)/@fromA)+@df*((@fromA*(1-@fromES)/POWER(1-@fromES*sin(fromTheta)*sin(fromTheta), 1.5))/@bda+(@fromA/SQRT(1.00-@fromES*sin(fromTheta)*sin(fromTheta)))*@bda)*sin(fromTheta)*cos(fromTheta))/((@fromA*(1-@fromES)/POWER(1-@fromES*sin(fromTheta)*sin(fromTheta), 1.5)) + fromH) AS deltaTheta,
(-@dX*sin(fromLamda)+@dY*cos(fromLamda))/((((@fromA/SQRT(1.00-@fromES*sin(fromTheta)*sin(fromTheta))) +fromH) * cos(fromTheta)) AS deltaLamda,
@dX*cos(fromTheta)*cos(fromLamda)+@dY*cos(fromTheta)*sin(fromLamda)+@dZ*sin(fromTheta)-@da*@fromA/(@fromA/SQRT(1.00-@fromES*sin(fromTheta)*sin(fromTheta)))+@dF*@bda*(@fromA/SQRT(1.00-@fromES*sin(fromTheta)*sin(fromTheta)))*sin(fromTheta)*sin(fromTheta) AS deltaH
FROM TABLENAME
Sunting: beberapa variabel yang seharusnya merupakan nama kolom, dan koma serta tanda kurung yang hilang.
Sunting: satu lagi kurung.
Saya telah menguji formula ini dan berfungsi menggunakan titik acak terhadap transformasi ArcGIS. Ingatlah bahwa unit Anda mungkin dalam kaki / derajat. Ingat juga hasil ini adalah delta, jadi Anda harus menambahkannya terhadap nilai Anda untuk mendapatkan hasil akhir.