- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
假设我给了一个点(纬度,经度)和一个距离,如何在Android谷歌地图中得到在四个方向上指定距离的另一个点?
示例我给出一个点 LatLng(X,Y) 和一个 10 英里的距离。我应该在给定距离内的所有四个方向(NORTH,SOUTH,EAST,WEST)接收四个点。
最佳答案
使用 Google Maps Android API Utility Library您可以使用 SphericalUtil.computeOffset
方法。来自 the documentation :
public static LatLng computeOffset(LatLng from,
double distance,
double heading)Returns the LatLng resulting from moving a distance from an origin in the specified heading (expressed in degrees clockwise from north).
Parameters:
- from - The LatLng from which to start.
- distance - The distance to travel.
- heading - The heading in degrees clockwise from north.
在您的情况下,您将需要使用四个标题:0 代表 NORTH,90 代表 EAST,180 代表 SOUTH,270 代表 WEST。
另外,请注意距离参数以米为单位。
关于android - 如何在Android Google Maps中获取距指定点(Lat,Lng)X距离的纬度,经度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35592054/
这个问题在这里已经有了答案: Measuring the distance between two coordinates in PHP (13 个答案) 关闭 9 年前。 我在数据库中存储了 fi
我想在 Google map 标记完成拖动时检索正确的 lat/lng。 但是对于同一个精确点,它给出了两个不同的(非常近似)坐标。 同一掉落的示例结果: evt.latLng:39.82213542
我有一个 mysql 插入语句,当系统无法获取用户的纬度/经度时,该语句会中断。sql 是这样的: INSERT INTO users(user_email, first_name , last_na
我有一个页面,用户可以在“邮政编码”字段中输入他们的地址。我还有一个“检测位置”按钮,可以对用户地址进行地理定位。当他们单击此按钮时,他们的城市名称和邮政编码将回显到“邮政编码”字段中,并且纬度和经度
我有两个表:一个 map 表,其中包含大约 3,000 个纬度/经度对,代表现实世界的“标记”位置;还有一个建筑物表,其中有数百个纬度/经度对,也代表真实世界的建筑物位置。我想做的是获取所有建筑物可见
假设我有一个 lat lng 坐标,我想把它放在一个 10 公里宽的正方形的中心,然后得到最小的 lat/lng 和最大的 lat/lng。 有没有一种简单的方法可以做到这一点已经存在? 最佳答案 如
在过去的几天里,我一直在努力寻找这个问题的答案。我有一个 GPS 数据路线表。和一张积分表。我需要的是一个 MySql 语句,对于给定的路线,将告诉我两个端点的 Point.Name。我可以写 4 个
我见过这个问题的许多变体,但我无法将他们的答案与我的具体需求联系起来。 我有几组 3 纬度/经度坐标对。任何集合中的坐标彼此之间都在几公里之内。 对于每个集合,我想将坐标转换为 x/y 值,以便我可以
我正在为 React 创建一个节点模块,只是为了尝试一下并了解更多信息。但我面临一个问题。我想让这个模块没有任何依赖项(React 除外),但我也想在我的模块中包含 I18n。我开始像这样的文件结构:
我使用mapbox/leaflet来显示人体图片而不是常规 map 。 我正在使用传单绘制,我需要能够创建一个圆并在保持其半径的同时移动它。然而,当我将其移向 map /屏幕底部时,大小呈指数级增加。
大家好,我目前正在 android 中使用 DH key 交换开发客户端服务器应用程序。我在客户端将字符串转换为 long 时遇到问题,奇怪的是该转换适用于前 2 个变量 pValue 和 gValu
我试图从数据库中的多点列获取值(纬度和经度)。我有针对点的有效解决方案,但找不到针对多点的解决方案。 我有一个点及其坐标的SQL查询,对于多点及其点我需要这样的东西: SELECT ASWKT(poi
我有一个保存地址的 mysql 记录数据库。我想迭代这些地址并获取每个地址的地理编码 lat 和 lng 并将它们放入数据库中。我正在使用 php。但是当我运行此代码时,我收到一条错误消息“FastC
我想要提取纬度。和来自字符串的经度值,如下所示: var data = "(-20.210696507479017, -70.14000177383423),(-20.21202551027535,
给定具有经纬度位置的地点数据库,例如 40.8120390、-73.4889650,我如何找到特定位置给定距离内的所有位置? 从数据库中选择所有位置,然后一个一个地遍历它们,获取与起始位置的距离,看它
我计划在我的一个应用程序中使用谷歌地图“containsLocation()”API。文档链接是 - https://goo.gl/4BFHCz 我正在使用相同的示例。这是我的代码。
我有 4 个变量: $southwest_lat、$southwest_lng、$northeast_lat、$northeast_lng 我还有一个数据库表,其中包含以下字段:名称、纬度和经度。 /
我正在尝试将标记数据放入表单上的隐藏字段中。我不确定为什么这不起作用,它一定是我的 js 语法中的某些内容: var initialLocation; var siberia = new google
我正在使用 Google map 函数 map.getCenter().lng(); 它返回 lng 值,但一旦我尝试对 lng 值执行任何操作,我就会收到错误,例如: var lang = sawd
假设我有几个带有 4 个坐标对(仅长/纬度)的边界框,每个坐标对代表一个方框的 4 个角。我如何检查其中两个框是否相交? 我知道我可以使用java.awt.Rectangle来检查两个矩形是否相交,但
我是一名优秀的程序员,十分优秀!