如何找到医院地点附近我的位置?我的、地点、附近、位置

2023-09-04 03:19:19 作者:傾心☆不傾城

我想知道关于如何找到医院的位置,靠近我的位置使用Android的,怎么可能呢?,我可以使用谷歌的数据库,获取经纬度值对于医院的位置,怎么可能?

I wanna idea about "How to find Hospital Location near by my location" using android,How is possible?,can i use google's database for get latitude and longitude value for Hospital location,How is possible?

感谢所有

推荐答案

距离的计算是基于的LatLong数学这样:

Distance calculations are based on LatLong math such that:

距离

本使用了半正矢的公式计算出两点之间的大圆距离 - 也就是,在地球表面的最短距离 - 给点之间的为最乌鸦飞'的距离(忽略任何小山!)。

This uses the ‘haversine’ formula to calculate great-circle distances between the two points – that is, the shortest distance over the earth’s surface – giving an ‘as-the-crow-flies’ distance between the points (ignoring any hills!).

半正矢公式:

R =地球半径(平均半径=6371公里) Δlat= lat2- LAT1 Δlong= long2- long1 一个=sin²(Δlat/ 2)+ COS(LAT1)名为.cos(LAT2).sin²(Δlong/ 2) C = 2.atan2(√A,√(1-A)) D = R.C

R = earth’s radius (mean radius = 6,371km) Δlat = lat2− lat1 Δlong = long2− long1 a = sin²(Δlat/2) + cos(lat1).cos(lat2).sin²(Δlong/2) c = 2.atan2(√a, √(1−a)) d = R.c

(注意,角度需要在弧度传递到三角函数)。 JavaScript的:

(Note that angles need to be in radians to pass to trig functions). JavaScript:

变种R = 6371; //公里 变种DLAT =(LAT2-LAT1).toRad(); 变种dLon =(lon2-lon1).toRad(); 变种一个= Math.sin(DLAT / 2)* Math.sin(DLAT / 2)+         Math.cos(lat1.toRad())* Math.cos(lat2.toRad())*         Math.sin(dLon / 2)* Math.sin(dLon / 2); 变种C = 2 * Math.atan2(的Math.sqrt(a)中,的Math.sqrt(1-a))的; VAR D = R *℃;

var R = 6371; // km var dLat = (lat2-lat1).toRad(); var dLon = (lon2-lon1).toRad(); var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) * Math.sin(dLon/2) * Math.sin(dLon/2); var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); var d = R * c;

 
精彩推荐
图片推荐