【问题标题】:How do I create a pair of longitude and latitudes to show a 2 mile radius of a particular longitude and latitude? in Java Android如何创建一对经度和纬度以显示特定经度和纬度的 2 英里半径?在 Java 中
【发布时间】:2014-02-23 19:41:46
【问题描述】:

超出了我的深度 :-) 如何创建一对经度和纬度来创建一个多边形,以显示特定经度和纬度的 2 英里半径?在 Java 安卓中。我知道如何找到您当前的经度和纬度,但我无法弄清楚以上内容。

到目前为止我的代码如下:

LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); 
Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
double longitude = location.getLongitude();
double latitude = location.getLatitude();

【问题讨论】:

  • 不是 Android 用户,但在 Java Swing 中,您将创建一个具有指定中心和两英里半径的圆。如果Android没有圆圈,那就太糟糕了,你必须从线条(如你所说的多边形)创建一个,这是基本的三角学:使用极坐标系,xcenter + r * cost (fi), ycenter + r *辛菲。希望你不必诉诸于此!
  • 另外,如果你需要做的只是确定一个特定点是否在你的坐标的某个半径内,你可以这样: if ((x - x0) * (x - x0 ) + (y - y0) * (y - y0)

标签: java android google-maps latitude-longitude


【解决方案1】:

您可以使用 LatLng 创建对。

        LatLng origin = new LatLng(my_latitude,my_longitude);

要创建半径,您可以使用 Genofencing 技术。

https://developer.android.com/training/location/geofencing.html

【讨论】:

  • 你能再解释一下吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-09-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-10-26
  • 2015-09-15
相关资源
最近更新 更多