検索 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_min
1 組の座標のみを入力する場合は、 、lon_max
、lat_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;