围绕一个地理坐标的BoundingBox [英] BoundingBox around a geo coordinate

查看:228
本文介绍了围绕一个地理坐标的BoundingBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前打了一下Android和GPS跟踪等。

I am currently playing a bit with Android and GPS tracking and so forth.

我发现,我有打电话给我带想得到例如兴趣点边界的角点的OSM API。我想实现,我得到我目前cooredinates从手机(其中媒体链接的作品),然后得到一些OSM兴趣点边界框在我的当前位置为中心。

I found out, that I have to call the OSM API with the corner points of the bounding I want to get POIs for example. I would like to achieve, that I get my current cooredinates from the handset (which allready works) and then get some pois from OSM for the bounding box where my current position is the center.

我能想象这样的功能:

公开地图getBoundingBox(双长,双纬度,INT米);

public Map getBoundingBox(Double long, Double lat, int meters);

但我没有任何想法如何计算这个边界框。
可能有人给我一些提示吗?

BUT I do not have any idea how to calculate this bounding box. Could someone give me some hints please?

欢呼,基督教

推荐答案

我认为长和纬度都在几秒钟内给出。

I assume that long and lat are given in seconds.

首先,你需要计算以秒为矩形的宽度。一秒赤道30.9米,其他纬度,通过COS(LAT)大量繁殖,所以将其转换为秒你做到以下几点:

First, you need to calculate width of the rectangle in seconds. One second is 30.9 meters on the equator, for other latitudes, multiply by cos(lat), so to convert it to seconds you do the following:

double widthSeconds = meters / (30.9 * cos(lat));

二,知道了框的中心,很容易计算出角的坐标:

Second, knowing the center of the box, it's easy to calculate the coordinates of corners:

编辑:上面的例子适用于欧洲和亚洲。对于其它位置,坐标轴的方向可以是不同的。

the example above works for Europe and Asia. For other locations, directions of coordinate axes may be different.

这篇关于围绕一个地理坐标的BoundingBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆