Commit 8c97eac8 authored by 2xe's avatar 2xe
Browse files

Initial Drupal 6 release

parent c7144a46
// $Id
- Added functions for continent codes, country info, feature code info, us states info
- Added some tables and functions for metadata to local tables (countryinfo and featurecodes)
- Removed all "module_invoke_all" calls.
- Aggregated the full configuration in geonames_config.inc
- Probably done lots of other stuff as well ;)
COMMITTED 29.09:
geonames bugfix line 462/465.. "==" to "=", and "else if" to "if"
wikipediasearch changed columns from associative array to array
wikipediabbox changed columns from associative array to array
PENDING:
postalcodesearch styled code
children styled code
countrycode styled code
countryinfo styled code
countrysubdivision styled code
hierarchy styled code
nearbyplace
; $id$
name = Geonames API
description = The Geonames API provides the programming framework for the Geonames services. You must install this module before you install any of the services.
package = Geonames
version = "$Name$"
\ No newline at end of file
; $id$
name = GeoNames API
description = The GeoNames API provides the programming framework for the GeoNames services.
package = Geonames
core = 6.x
php = 5.1
\ No newline at end of file
<?php
// $Id
/**
* Implementation of hook_schema()
*/
function geonames_schema() {
$schema['geonames_countryinfo'] = array(
'fields' => array(
'iso_alpha2' => array(
'type' => 'varchar',
'not null' => true,
'length' => 2,
),
'iso_alpha3' => array(
'type' => 'varchar',
'not null' => true,
'length' => 3,
),
'iso_numeric' => array(
'type' => 'int',
'not null' => true,
'size' => 'tiny',
'unsigned' => true,
),
'fips_code' => array(
'type' => 'varchar',
'not null' => true,
'length' => 3,
),
'name' => array(
'type' => 'varchar',
'not null' => true,
'length' => 60,
),
'capital' => array(
'type' => 'varchar',
'not null' => true,
'length' => 60,
),
'areainsqkm' => array(
'type' => 'varchar',
'not null' => true,
'length' => 11,
),
'population' => array(
'type' => 'varchar',
'not null' => true,
'length' => 11,
),
'continent' => array(
'type' => 'varchar',
'not null' => true,
'length' => 2,
),
'languages' => array(
'type' => 'varchar',
'not null' => true,
'length' => 100,
),
'currency' => array(
'type' => 'varchar',
'not null' => true,
'length' => 3,
),
'geonameid' => array(
'type' => 'int',
'not null' => true,
'unsigned' => true,
),
),
'indexes' => array(
'iso_alpha3' => array('iso_alpha3'),
'iso_numeric' => array('iso_numeric'),
'fips_code' => array('fips_code'),
'continent' => array('continent'),
'currency' => array('currency'),
'iso_alpha2' => array('iso_alpha2'),
),
'primary key' => array('geonameid'),
);
$schema['geonames_featurecodes'] = array(
'fields' => array(
'class' => array(
'type' => 'varchar',
'length' => 1,
'not null' => true,
),
'code' => array(
'type' => 'varchar',
'length' => 4,
'not null' => true,
),
'name' => array(
'type' => 'varchar',
'not null' => true,
'length' => 40,
),
'description' => array(
'type' => 'varchar',
'not null' => true,
'length' => 255,
),
),
'primary key' => array('class,code'),
);
return $schema;
}
/**
* Implementation of hook_install()
*/
function geonames_install() {
drupal_install_schema('geonames');
}
/**
* Implementation of hook_uninstall()
*/
function geonames_uninstall() {
drupal_uninstall_schema('geonames');
}
\ No newline at end of file
This diff is collapsed.
<?php
// $Id
/**
* GeoNames Configuration
*
* @param $a, $b see function
*
* @return see bottom of function...
*/
function geonames_config($a = NULL, $b = NULL) {
$config['search'] = array(
'service_name' => 'search',
'service_full_name' => 'GeoNames Fulltext Search',
'description' => t('Search provides names and information for geographical locations, it is probably the most comprehensive search available from GeoNames and has numereous possible parameter combinations. Note that this service allows some parameters to be arrays: country, featureclass and featurecode.'),
'service_path' => 'search',
'credit_cost' => 1,
'result_cache_prefix' => 'seares:',
'data_cache_prefix' => 'seadat:',
'allowed_parameters' => array(
// our style // geonames style
'query' => 'q',
'name' => 'name',
'name_equals' => 'name_equals',
'maxrows' => 'maxRows',
'startrow' => 'startRow',
'country' => 'country',
'admincode1' => 'adminCode1',
'admincode2' => 'adminCode2',
'admincode3' => 'adminCode3',
'featureclass' => 'featureClass',
'featurecode' => 'featureCode',
'lang' => 'lang',
'style' => 'style',
),
'array_parameters' => array( // Parameters that are allowed to be arrays (or just string)
'country',
'featurecode',
'featureclass',
),
'required_parameters' => array( // If you have set query_defaults you should not include the parameter here
'query',
'name',
'name_equals'
),
'required_parameters_type' => 'single',
'query_defaults' => array(
'type' => 'xml',
'maxrows' => 15,
'featureclass' => 'p',
'startrow' => 0
),
'pager' => TRUE,
'detect_style' => TRUE,
);
$config['postalcodecountryinfo'] = array(
'service_name' => 'postalcodecountryinfo',
'service_full_name' => 'Postal Code Country Info',
'description' => 'Find countries for which postal code geocoding is available.',
'service_path' => 'postalCodeCountryInfo',
'credit_cost' => 1,
'result_cache_prefix' => 'pccires:',
'data_cache_prefix' => 'pccidat:',
'allowed_parameters' => array(
'country',
),
'columns' => array(
'countrycode',
'countryname',
'numpostalcodes',
'minpostalcode',
'maxpostalcode',
),
);
$config['children'] = array(
'service_name' => 'children',
'service_full_name' => 'Place Hierarchy: Children',
'description' => t('Find the children of a given geonameId.'),
'service_path' => 'children',
'credit_cost' => 1,
'result_cache_prefix' => 'hcres:',
'data_cache_prefix' => 'hcdat:',
'allowed_parameters' => array(
// our style // geonames style
'geonameid' => 'geonameId',
'style' => 'style',
'lang' => 'lang',
),
'required_parameters' => array(
'geonameid',
),
'required_parameters_type' => 'single',
'detect_style' => TRUE,
);
$config['countrycode'] = array(
'service_name' => 'countrycode',
'service_full_name' => 'Country Code (reverse geocoding)',
'description' => t('Find Country Code from latitude and longitude'),
'service_path' => 'countrycode',
'credit_cost' => 1,
'result_cache_prefix' => 'ccres:',
'data_cache_prefix' => 'ccdat:',
'allowed_parameters' => array(
//our style geonames style
'lat' => 'lat',
'lng' => 'lng',
'lang' => 'lang',
'type' => 'type',
),
'required_parameters' => array( // If you have set query_defaults you should not include the parameter here
'lat',
'lng'
),
'required_parameters_type' => 'all',
'query_defaults' => array(
'type' => 'xml'
),
'columns' => array('countrycode', 'countryname'),
);
$config['countryinfo'] = array(
'service_name' => 'countryinfo',
'service_full_name' => 'Country Info (Bounding Box, Capital, Area in square km, Population)',
'description' => 'Find countries for which postal code geocoding is available.',
'service_path' => 'countryInfo',
'credit_cost' => 1,
'result_cache_prefix' => 'couires:',
'data_cache_prefix' => 'couidat:',
'allowed_parameters' => array(
//our style geonames style
'country' => 'country',
'lang' => 'lang',
),
'columns' => array(
'countrycode',
'countryname',
'isonumeric',
'isoalpha3',
'fipscode',
'continent',
'capital',
'areainsqkm',
'population',
'currencycode',
'languages',
'geonameid',
'bboxwest',
'bboxnorth',
'bboxsouth',
'bboxeast',
),
);
$config['countrysubdivision'] = array(
'service_name' => 'countrysubdivision',
'service_full_name' => 'Country Subdivision (reverse geocoding)',
'description' => t('Find Country Code from latitude and longitude'),
'service_path' => 'countrySubdivision',
'credit_cost' => 1,
'result_cache_prefix' => 'csres:',
'data_cache_prefix' => 'csdat:',
'allowed_parameters' => array(
//our style geonames style
'lat' => 'lat',
'lng' => 'lng',
'lang' => 'lang',
),
'required_parameters' => array( // If you have set query_defaults you should not include the parameter here
'lat',
'lng'
),
'required_parameters_type' => 'all',
'columns' => array('countrycode', 'countryname', 'admincode1', 'adminname1'),
);
$config['gtopo30'] = array(
'service_name' => 'gtopo30',
'service_full_name' => 'Elevation - GTOPO30',
'description' => t('GTOPO30 is a global digital elevation model (DEM) with a horizontal grid spacing of 30 arc seconds (approximately 1 kilometer). GTOPO30 was derived from several raster and vector sources of topographic information.'),
'service_path' => 'gtopo30',
'credit_cost' => 0,
'result_cache_prefix' => 'gtpres:',
'data_cache_prefix' => 'gtpdat:',
'allowed_parameters' => array(
//our style geonames style
'lat' => 'lat',
'lng' => 'lng',
'type' => 'type',
),
'required_parameters' => array( // If you have set query_defaults you should not include the parameter here
'lat',
'lng'
),
'required_parameters_type' => 'all',
'query_defaults' => array(
'type' => 'xml'
),
);
$config['hierarchy'] = array(
'service_name' => 'hierarchy',
'service_full_name' => 'Place Hierarchy: Hierarchy',
'description' => t('Find all Geonames higher up in the hierarchy of a place name.'),
'service_path' => 'hierarchy',
'credit_cost' => 1,
'result_cache_prefix' => 'hires:',
'data_cache_prefix' => 'hidat:',
'allowed_parameters' => array(
// our style // geonames style
'geonameid' => 'geonameId',
'style' => 'style',
'lang' => 'lang',
),
'required_parameters' => array(
'geonameid',
),
'required_parameters_type' => 'single',
'detect_style' => TRUE,
);
$config['nearbyplace'] = array(
'service_name' => 'nearbyplace',
'service_full_name' => 'Find nearby Place Name (reverse geocoding)',
'description' => t('Find nearby place name (reverse geocoding)'),
'service_path' => 'findNearbyPlaceName',
'credit_cost' => 4,
'result_cache_prefix' => 'neares:',
'data_cache_prefix' => 'neadat:',
'allowed_parameters' => array(
//our style geonames style
'lat' => 'lat',
'lng' => 'lng',
'radius' => 'radius',
'maxrows' => 'maxRows',
'style' => 'style', // Default = MEDIUM
),
'query_defaults' => array(
'radius' => 20
),
'required_parameters' => array( // If you have set query_defaults you should not include the parameter here
'lat',
'lng'
),
'required_parameters_type' => 'all',
);
$config['nearbypostalcodes'] = array(
'service_name' => 'nearbypostalcodes',
'service_full_name' => 'Find nearby Postal Codes (reverse geocoding)',
'description' => 'Find nearby Postal Codes (reverse geocoding)',
'service_path' => 'findNearbyPostalCodes',
'credit_cost' => 2,
'result_cache_prefix' => 'nbpres:',
'data_cache_prefix' => 'nbpdat:',
'allowed_parameters' => array(
//our style geonames style
'lat' => 'lat',
'lng' => 'lng',
'radius' => 'radius',
'postalcode' => 'postalcode',
'maxrows' => 'maxRows', // Geonames default = 5
'country' => 'country', // Geonames default = ALL
'style' => 'style',
),
'required_parameters' => array( // If you have set query_defaults you should not include the parameter here
array('lat', 'lng'),
array('postalcode', 'country')
),
'required_parameters_type' => 'all',
'query_defaults' => array(
'maxrows' => 15,
'radius' => 10,
'style' => 'medium',
),
'columns' => array(
'postalcode',
'name',
'countrycode',
'lat',
'lng',
'distance',
'admincode1',
'admincode2',
'admincode3',
'adminname1',
'adminname2',
'adminname3',
),
);
$config['nearbywikipedia'] = array(
'service_name' => 'nearbywikipedia',
'service_full_name' => 'Find nearby Wikipedia Entries (reverse geocoding)',
'description' => 'Find nearby Wikipedia Entries (reverse geocoding)',
'service_path' => 'findNearbyWikipedia',
'credit_cost' => 2,
'result_cache_prefix' => 'wikres:',
'data_cache_prefix' => 'wikdat:',
'allowed_parameters' => array(
//our style geonames style
'lat' => 'lat',
'lng' => 'lng',
'radius' => 'radius',
'postalcode' => 'postalcode',
'lang' => 'lang', // Geonames default = en
'maxrows' => 'maxRows', // Geonames default = 5
'country' => 'country', // Geonames default = ALL
),
'pager' => false,
'required_parameters' => array( // If you have set query_defaults you should not include the parameter here
array('lat', 'lng'),
array('postalcode', 'country')
),
'required_parameters_type' => 'all',
'query_defaults' => array(
'maxrows' => 15,
'radius' => 10
),
'columns' => array(
'summary' => 'summary',
'feature' => 'feature',
'population' => 'population',
'elevation' => 'elevation',
'lat' => 'lat',
'lng' => 'lng',
'wikipediaurl' => 'wikipediaUrl',
'thumbnailimg' => 'thumbnailImg',
'lang' => 'lang',
'distance' => 'distance',
),
);
$config['neighbours'] = array(
'service_name' => 'neighbours',
'service_full_name' => 'Place Hierarchy: Neighbours',
'description' => t('Returns the neighbours for a given geonameId.'),
'service_path' => 'neighbours',
'credit_cost' => 1,
'result_cache_prefix' => 'hnres:',
'data_cache_prefix' => 'hndat:',
'allowed_parameters' => array(
// our style // geonames style
'geonameid' => 'geonameId',
'style' => 'style',
'lang' => 'lang',
),
'required_parameters' => array(
'geonameid',
),
'required_parameters_type' => 'single',
'detect_style' => TRUE,
);
$config['postalcodesearch'] = array(
'service_name' => 'postalcodesearch',
'service_full_name' => 'Postal Code Search',
'description' => t('Postalcode search provides placenames/postalcodes for locations.'),
'service_path' => 'postalCodeSearch',
'credit_cost' => 1,
'result_cache_prefix' => 'pcsres:',
'data_cache_prefix' => 'pcsdat:',
'allowed_parameters' => array(
// our style // geonames style
'postalcode' => 'postalcode',
'placename' => 'placename',
'maxrows' => 'maxRows',
'style' => 'style',
'country' => 'country', // if not set -- all countries
),
'required_parameters' => array( // If you have set query_defaults you should not include the parameter here
'postalcode',
'placename',
),
'required_parameters_type' => 'single',
'query_defaults' => array(
'maxrows' => 10,
'style' => 'medium',
),
'columns' => array(
'postalcode',
'name',
'countrycode',
'lat',
'lng',
'admincode1',
'adminname1',
'admincode2',
'adminname2',
'admincode3',
'adminname3'
),
);
$config['siblings'] = array(
'service_name' => 'siblings',
'service_full_name' => 'Place Hierarchy: Siblings',
'description' => t('Returns the siblings for a given geonameId.'),
'service_path' => 'siblings',
'credit_cost' => 1,
'result_cache_prefix' => 'hsres:',
'data_cache_prefix' => 'hsdat:',
'allowed_parameters' => array(
// our style // geonames style
'geonameid' => 'geonameId',
'style' => 'style',
'lang' => 'lang',
),
'required_parameters' => array(
'geonameid',
),
'required_parameters_type' => 'single',
'detect_style' => TRUE,
);
$config['srtm3'] = array(
'service_name' => 'srtm3',
'service_full_name' => 'Elevation - SRTM3',
'description' => t('Shuttle Radar Topography Mission (SRTM) elevation data. The dataset covers land areas between 60 degrees north and 56 degrees south. This web service is using SRTM3 data with data points located every 3-arc-second (approximately 90 meters) on a latitude/longitude grid. Result: a single number giving the elevation in meters according to srtm3, ocean areas have been masked as "no data" and have been assigned a value of -32768'),
'service_path' => 'srtm3',
'credit_cost' => 1,
'result_cache_prefix' => 'strmres:',
'data_cache_prefix' => 'strmdat:',
'allowed_parameters' => array(
//our style geonames style
'lat' => 'lat',
'lng' => 'lng',
'type' => 'type',
),
'required_parameters' => array( // If you have set query_defaults you should not include the parameter here
'lat',
'lng'
),
'required_parameters_type' => 'all',
'query_defaults' => array(
'type' => 'xml'
),
);
$config['timezone'] = array(
'service_name' => 'timezone',
'service_full_name' => 'Timezone',
'description' => t('Find the timezone for a given lat/lng with gmt offset (1. January) and dst offset (1. July)'),
'service_path' => 'timezone',
'credit_cost' => 1,
'result_cache_prefix' => 'tzres:',
'data_cache_prefix' => 'tzdat:',
'allowed_parameters' => array(
//our style geonames style
'lat' => 'lat',
'lng' => 'lng',
),
'required_parameters' => array( // If you have set query_defaults you should not include the parameter here
'lat',
'lng'
),
'required_parameters_type' => 'all',
'query_defaults' => array(
'type' => 'xml'
),
'columns' => array('countrycode','countryname','lat','lng','timezoneid','dstoffset','gmtoffset'),
);
$config['wikipediabbox'] = array(
'service_name' => 'wikipediabbox',
'service_full_name' => 'Wikipedia Articles from Bounding Box',
'description' => 'Search Wikipedia entries within the Bounding Box',
'service_path' => 'wikipediaBoundingBox',
'credit_cost' => 1,
'result_cache_prefix' => 'wikbres:',
'data_cache_prefix' => 'wikbdat:',
'allowed_parameters' => array(
//our style geonames style
'north' => 'north',
'south' => 'south',
'east' => 'east',
'west' => 'west',
'lang' => 'lang',
'maxrows' => 'maxRows',
),
'required_parameters' => array( // If you have set query_defaults you should not include the parameter here
'north',
'south',