Sf geonames

From ARK
Revision as of 13:04, 19 November 2011 by Stuarteve (talk | contribs) (Example Configuration)

Jump to: navigation, search

Description

The sf_geonames pulls the results from the GeoNames API [1]

Prerequisites

none

Additional Fields

sf_geonames takes the following extra fields:

  • 'coord_fields' - REQUIRED - this is an array of two number fields that will be used for the easting and northing respectively. The form assumes that the coordinates are in Lat Long WGS84 (EPSG:4326).
  • 'op_geonames_user' - OPTIONAL - geonames username. It is much better to setup a user account for your project on GeoNames, as this saves possible data overload problems. If you have done so add your usernames here.
  • 'op_fcodes' - OPTIONAL - this is a single-dim array of the feature codes you wish to try and retrieve from GeoNames and the order in which to print them. If this is not specified the administrative regions (ADM1, ADM2, ADM3 and ADM4) will be retrieved.
  • 'op_sf_cssclass' - OPTIONAL - if you wish to use a different css class to display the results

Example Configuration

An example of sf_rssfeed returning an ARK feed and the latest XKCD comics

$conf_mcd_geonames =
    array(
        'view_state' => 'max',
        'edit_state' => 'view',
        'sf_nav_type' => 'nmedit',
        'sf_title' => 'location', //appears in the titlebar of the subform (mk nname)
        'sf_html_id' => 'fst_cd_geonames', //the form id tag (must be unique)
        'script' => 'php/subforms/sf_geonames.php',
        'op_label' => 'save',
        'op_input' => 'save',
        'coord_fields' => array(
            $conf_field_easting,
            $conf_field_northing
        ),
	'op_geonames_user' => 'fasti',
	'op_fcodes' => array(
	    'ADM1' => 'geonames_ADM1', //Administrative Region 1 (i.e. Region)
	    'ADM2' => 'geonames_ADM2', //Administrative Region 2 (i.e. County/Province)
	    'ADM3' => 'geonames_ADM3',  //Administrative Region 3 (i.e. District/Comune)
	    'PCLI' => 'geonames_PCLI'  //Country
		),
    	'fields' => array(
    	)
);