首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Wikimapia.org Api

使用Wikimapia.org Api
EN

Stack Overflow用户
提问于 2011-12-01 03:21:20
回答 1查看 2.6K关注 0票数 1

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

代码语言:javascript
复制
http://api.wikimapia.org/?function=search
&key= myKey
&q=lat= theLatidute
&lon= theLongitude
&format=json

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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-12-01 03:56:51

搜索API要求您设置搜索位置(长整型和后型)以及要搜索该位置的内容的名称。

例如,要查找特定坐标附近的火车站,请执行以下操作:

代码语言:javascript
复制
http://api.wikimapia.org/?function=search&key=[key]&q=Train+Station&lat=[latitude]&lon=[longitude]&format=json

如果您只是尝试查找与坐标接近的对象列表,而没有搜索项,则需要使用带有小偏移量的box API:

代码语言:javascript
复制
 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

代码语言:javascript
复制
// 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;
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8331654

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档