| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Geonames nearbywikipedia API / by Erlend Eide, erlend(|)edesign.no
|
| 7 |
*
|
| 8 |
* http://www.geonames.org/export/wikipedia-webservice.html#findNearbyWikipedia
|
| 9 |
*
|
| 10 |
* Parameters :
|
| 11 |
* lang : language code (around 180 languages) (default = en)
|
| 12 |
* lat,lng, radius (in km), maxRows (default = 5),country (default = all countries)
|
| 13 |
* or
|
| 14 |
* postalcode,country, radius (in Km), maxRows (default = 5)
|
| 15 |
*
|
| 16 |
*/
|
| 17 |
|
| 18 |
/**
|
| 19 |
* Service configuration
|
| 20 |
*/
|
| 21 |
function geonames_nearbywikipedia_geoconfig($item = FALSE, $local = FALSE) {
|
| 22 |
$config = array(
|
| 23 |
'service_name' => 'nearbywikipedia',
|
| 24 |
'service_full_name' => 'Find nearby Wikipedia Entries (reverse geocoding)',
|
| 25 |
'description' => 'Find nearby Wikipedia Entries (reverse geocoding)',
|
| 26 |
'service_path' => 'findNearbyWikipedia',
|
| 27 |
'credit_cost' => 2,
|
| 28 |
'result_cache_prefix' => 'wikres:',
|
| 29 |
'data_cache_prefix' => 'wikdat:',
|
| 30 |
'allowed_parameters' => array(
|
| 31 |
//our style geonames style
|
| 32 |
'lat' => 'lat',
|
| 33 |
'lng' => 'lng',
|
| 34 |
'radius' => 'radius',
|
| 35 |
'postalcode' => 'postalcode',
|
| 36 |
'lang' => 'lang', // Geonames default = en
|
| 37 |
'maxrows' => 'maxRows', // Geonames default = 5
|
| 38 |
'country' => 'country', // Geonames default = ALL
|
| 39 |
),
|
| 40 |
'pager' => false,
|
| 41 |
'required_parameters' => array( // If you have set query_defaults you should not include the parameter here
|
| 42 |
array('lat', 'lng'),
|
| 43 |
array('postalcode', 'country')
|
| 44 |
),
|
| 45 |
'required_parameters_type' => 'all',
|
| 46 |
'query_defaults' => array(
|
| 47 |
'maxrows' => 15,
|
| 48 |
'radius' => 10
|
| 49 |
),
|
| 50 |
'columns' => array(
|
| 51 |
'summary' => 'summary',
|
| 52 |
'feature' => 'feature',
|
| 53 |
'population' => 'population',
|
| 54 |
'elevation' => 'elevation',
|
| 55 |
'lat' => 'lat',
|
| 56 |
'lng' => 'lng',
|
| 57 |
'wikipediaurl' => 'wikipediaUrl',
|
| 58 |
'thumbnailimg' => 'thumbnailImg',
|
| 59 |
'lang' => 'lang',
|
| 60 |
'distance' => 'distance',
|
| 61 |
),
|
| 62 |
);
|
| 63 |
return ($item ? ($local ? $config[$item] : array($config['service_name'] => $config[$item])) : array($config['service_name'] => $config));
|
| 64 |
}
|