使用 Wikimapia.org Api

发布于 2024-12-19 03:31:03 字数 280 浏览 1 评论 0原文

我正在尝试使用 wikimapia api 来查找特定城市或地点的经度和纬度的场所。 没有太多的文档,但我想这只是一个 http 请求。 现在,我遇到的问题是关于特定的 ulr。我尝试了这个:

http://api.wikimapia.org/?function=search
&key= myKey
&q=lat= theLatidute
&lon= theLongitude
&format=json

但似乎不起作用。任何帮助将不胜感激..

I am trying to use the wikimapia api for finding venues of specific cities or places given their longitude and latidute.
There isn't much of some documentation, but I suppose that it would just be an http request.
Now, the problem I have is about the specific ulr. I tried this one:

http://api.wikimapia.org/?function=search
&key= myKey
&q=lat= theLatidute
&lon= theLongitude
&format=json

but it doesn't seem to work. Any help will be appreciated..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜中书 2024-12-26 03:31:03

搜索 API 要求您设置搜索位置(经度和纬度)以及用于搜索该位置的内容的名称。

例如,要查找特定坐标附近的火车站:

http://api.wikimapia.org/?function=search&key=[key]&q=Train+Station&lat=[latitude]&lon=[longitude]&format=json

如果您只是想查找靠近某个坐标的对象列表,没有搜索词,则需要使用具有小偏移量的 box API:

 http://api.wikimapia.org/?function=box&key=[key]&lon_min=[lon_min]&lat_min=[lat_min]&lon_max=[lon_max]&lat_max=[lat_max]&format=json

如果您只需输入一组坐标,您可以像这样计算 lon_minlon_maxlat_minlat_max

// 1 degree latitude is roughly 111km, 0.001 degrees lat is about 100m
var lat_min = latitude - 0.001;
var lat_max = latitude + 0.001;

// 1 degree longitude is not a static value
// it varies in terms of physical distance based on the current latitude
// to compute it in meters, we do cos(latitude) * 111000
var meters_per_longdeg = Math.cos((3.141592 / 180) * latitude) * 111000;

// then we can work out how much longitude constitutes a change of ~100m
var range = 100 / meters_per_longdeg;

var long_min = longitude - range;
var long_max = longitude + range;

The search API requires that you set a search location (long and lat) as well as the name of something to search for that location.

For example, to find a train station near a particular coordinate:

http://api.wikimapia.org/?function=search&key=[key]&q=Train+Station&lat=[latitude]&lon=[longitude]&format=json

If you're just trying to find a list of objects that are close to a coordinate, without a search term, you need to use the box API with small offsets:

 http://api.wikimapia.org/?function=box&key=[key]&lon_min=[lon_min]&lat_min=[lat_min]&lon_max=[lon_max]&lat_max=[lat_max]&format=json

If you only want to input one set of coordinates, you can compute lon_min, lon_max, lat_min and lat_max like this:

// 1 degree latitude is roughly 111km, 0.001 degrees lat is about 100m
var lat_min = latitude - 0.001;
var lat_max = latitude + 0.001;

// 1 degree longitude is not a static value
// it varies in terms of physical distance based on the current latitude
// to compute it in meters, we do cos(latitude) * 111000
var meters_per_longdeg = Math.cos((3.141592 / 180) * latitude) * 111000;

// then we can work out how much longitude constitutes a change of ~100m
var range = 100 / meters_per_longdeg;

var long_min = longitude - range;
var long_max = longitude + range;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文