本文介紹了java 地心坐標系(ECEF)和WGS-84坐標系(WGS84)互轉的實現,分享給大家,具體如下:
成都創新互聯公司服務項目包括尚志網站建設、尚志網站制作、尚志網頁制作以及尚志網絡營銷策劃等。多年來,我們專注于互聯網行業,利用自身積累的技術優勢、行業經驗、深度合作伙伴關系等,向廣大中小型企業、政府機構等提供互聯網行業的解決方案,尚志網站推廣取得了明顯的社會效益與經濟效益。目前,我們服務的客戶以成都為中心已經輻射到尚志省份的部分城市,未來相信會繼續擴大服務區域并繼續獲得客戶的支持與信任!
public static String WGS84toECEF(double latitude, double longitude, double height) { double X; double Y; double Z; double a = 6378137; double b = 6356752.314245; double E = (a * a - b * b) / (a * a); double COSLAT = Math.cos(latitude * Math.PI / 180); double SINLAT = Math.sin(latitude * Math.PI / 180); double COSLONG = Math.cos(longitude * Math.PI / 180); double SINLONG = Math.sin(longitude * Math.PI / 180); double N = a / (Math.sqrt(1 - E * SINLAT * SINLAT)); double NH = N + height; X = NH * COSLAT * COSLONG; Y = NH * COSLAT * SINLONG; Z = (b * b * N / (a * a) + height) * SINLAT; return X + "," + Y + "," + Z; } public static String ECEFtoWGS84(double x, double y, double z) { double a, b, c, d; double Longitude;//經度 double Latitude;//緯度 double Altitude;//海拔高度 double p, q; double N; a = 6378137.0; b = 6356752.31424518; c = Math.sqrt(((a * a) - (b * b)) / (a * a)); d = Math.sqrt(((a * a) - (b * b)) / (b * b)); p = Math.sqrt((x * x) + (y * y)); q = Math.atan2((z * a), (p * b)); Longitude = Math.atan2(y, x); Latitude = Math.atan2((z + (d * d) * b * Math.pow(Math.sin(q), 3)), (p - (c * c) * a * Math.pow(Math.cos(q), 3))); N = a / Math.sqrt(1 - ((c * c) * Math.pow(Math.sin(Latitude), 2))); Altitude = (p / Math.cos(Latitude)) - N; Longitude = Longitude * 180.0 / Math.PI; Latitude = Latitude * 180.0 / Math.PI; return Longitude + "," + Latitude + "," + Altitude; }
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持創新互聯。
文章名稱:java地心坐標系(ECEF)和WGS-84坐標系(WGS84)互轉的實現
文章轉載:http://m.kartarina.com/article10/pphodo.html
成都網站建設公司_創新互聯,為您提供手機網站建設、域名注冊、網站設計、云服務器、網站設計公司、定制開發
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯