1

ウィキマピアAPIを使用して、経度と緯度を指定して特定の都市または場所の会場を検索しようとしています。いくつかのドキュメントはあまりありませんが、それは単なるhttpリクエストだと思います。さて、私が抱えている問題は特定のulrについてです。私はこれを試しました:

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

しかし、それは機能していないようです。どんな助けでもありがたいです。

4

1 に答える 1

4

検索 API では、検索場所 (経度と緯度) と、その場所を検索する対象の名前を設定する必要があります。

たとえば、特定の座標に近い鉄道駅を検索するには、次のようにします。

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

検索用語を使用せずに、座標に近いオブジェクトのリストを見つけようとしているだけの場合は、ボックス 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_min1 組の座標のみを入力する場合は、 、lon_maxlat_minおよび をlat_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;
于 2011-11-30T19:56:50.977 に答える