/[drupal]/contributions/modules/geonames/geonames_nearbypostalcodes.module
ViewVC logotype

Contents of /contributions/modules/geonames/geonames_nearbypostalcodes.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Thu Sep 20 10:55:58 2007 UTC (2 years, 2 months ago) by serosero
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-5, DRUPAL-6--2
File MIME type: text/x-php
First commit for Geonames API
1 <?php
2 // $Id$
3
4 /**
5 * @file
6 * Geonames nearbypostalcodes API / by Erlend Eide, erlend(|)edesign.no
7 *
8 * http://www.geonames.org/export/
9 *
10 * Parameters :
11 * lat,lng, radius (in km), maxRows (default = 5),style (verbosity : SHORT,MEDIUM,LONG,FULL),
12 * country (default = all countries)
13 * or
14 * postalcode,country, radius (in Km), maxRows (default = 5)
15 *
16 * Result : returns a list of postalcodes and places for the lat/lng query as xml document
17 *
18 *
19 * NOTE: Style is allways MEDIUM (supported in formats SHORT/MEDIUM -- but there is so little to
20 * save by requesting the SHORT format, so we allways use MEDIUM - which also is default)
21 */
22
23 /**
24 * Service configuration
25 */
26 function geonames_nearbypostalcodes_geoconfig($item = FALSE, $local = FALSE) {
27 $config = array(
28 'service_name' => 'nearbypostalcodes',
29 'service_full_name' => 'Find nearby Postal Codes (reverse geocoding)',
30 'description' => 'Find nearby Postal Codes (reverse geocoding)',
31 'service_path' => 'findNearbyPostalCodes',
32 'credit_cost' => 2,
33 'result_cache_prefix' => 'nbpres:',
34 'data_cache_prefix' => 'nbpdat:',
35 'allowed_parameters' => array(
36 //our style geonames style
37 'lat' => 'lat',
38 'lng' => 'lng',
39 'radius' => 'radius',
40 'postalcode' => 'postalcode',
41 'maxrows' => 'maxRows', // Geonames default = 5
42 'country' => 'country', // Geonames default = ALL
43 'style' => 'style',
44 ),
45 'required_parameters' => array( // If you have set query_defaults you should not include the parameter here
46 array('lat', 'lng'),
47 array('postalcode', 'country')
48 ),
49 'required_parameters_type' => 'all',
50 'query_defaults' => array(
51 'maxrows' => 15,
52 'radius' => 10,
53 'style' => 'medium',
54 ),
55 'columns' => array(
56 'postalcode',
57 'name',
58 'countrycode',
59 'lat',
60 'lng',
61 'distance',
62 'admincode1',
63 'admincode2',
64 'admincode3',
65 'adminname1',
66 'adminname2',
67 'adminname3',
68 ),
69 );
70 return ($item ? ($local ? $config[$item] : array($config['service_name'] => $config[$item])) : array($config['service_name'] => $config));
71 }

  ViewVC Help
Powered by ViewVC 1.1.2