upoints.geonames.Location

Package upoints :: Module geonames :: Class Location |
[hide private]
[frames] | no frames]

# Class Location

          object --+
                   |
         point.Point --+
                       |
    trigpoints.Trigpoint --+
                           |
                          Location

Class for representing a location from a geonames.org data file

All country codes are specified with their two letter ISO-3166 country code.

Since: 0.3.0

Instance Methods | [hide private]
__init__(self, geonameid, name, asciiname, alt_names, latitude, longitude, feature_class, feature_code, country, alt_country, admin1, admin2, admin3, admin4, population, altitude, gtopo30, tzname, modified_date, timezone=None) Initialise a new Location object |
`str` |
__str__(self, mode=`'``dd``'`) Pretty printed location string |
Inherited from `point.Point`: `__dict__`, `__eq__`, `__hash__`, `__ne__`, `__repr__`, `__unicode__`, `bearing`, `destination`, `distance`, `final_bearing`, `forward`, `inverse`, `midpoint`, `sun_events`, `sunrise`, `sunset`, `to_grid_locator` Inherited from `point.Point` (private): `_set_location` Inherited from `object`: `__delattr__`, `__getattribute__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`

Class Variables | [hide private]
| __TIMEZONES = `{}` `dateutil.gettz` cache to speed up generation

Instance Variables | [hide private]
| admin1 FIPS code (subject to change to ISO code), ISO code for the US and CH
| admin2 Code for the second administrative division, a county in the US
| admin3 Code for third level administrative division
| admin4 Code for fourth level administrative division
| alt_country Alternate country codes for location
| alt_names Alternate names for the location
| altitude Location's altitude
| asciiname Name of geographical location in ASCII encoding
| country Location's country
| feature_class Location's type
| feature_code Location's code
| geonameid ID of record in geonames database
| gtopo30 Average elevation of 900 square metre region, if available
| latitude Location's latitude
| longitude Locations's longitude
| modified_date Location's last modification date in the geonames databases
| name Location's name
| population Location's population, if applicable
| timezone Location's offset from UTC in minutes
| tzname The timezone identifier using POSIX timezone names
Inherited from `trigpoints.Trigpoint`: `identity` Inherited from `point.Point`: `rad_latitude`, `rad_longitude`, `units`

Properties | [hide private]
Inherited from `point.Point` (private): `_angle`, `_latitude`, `_longitude`, `_rad_latitude`, `_rad_longitude` Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, geonameid, name, asciiname, alt_names, latitude, longitude, feature_class, feature_code, country, alt_country, admin1, admin2, admin3, admin4, population, altitude, gtopo30, tzname, modified_date, timezone=None) (Constructor) |
Initialise a new Location object
    >>> Location(2636782, "Stotfold", "Stotfold", None, 52.0, -0.2166667,
    ...          "P", "PPL", "GB", None, "F8", None, None, None, 6245,
    ...          None, 77, "Europe/London", datetime.date(2007, 6, 15), 0)
    Location(2636782, 'Stotfold', 'Stotfold', None, 52.0, -0.2166667, 'P',
             'PPL', 'GB', None, 'F8', None, None, None, 6245, None, 77,
             'Europe/London', datetime.date(2007, 6, 15), 0)
Parameters: `geonameid` (`int`) - ID of record in geonames database `name` (Unicode `str`) - Name of geographical location `asciiname` (`str`) - Name of geographical location in ASCII encoding `alt_names` (`list` of Unicode `str`) - Alternate names for the location `latitude` (`float`) - Location's latitude `longitude` (`float`) - Location's longitude `feature_class` (`str`) - Location's type `feature_code` (`str`) - Location's code `country` (`str`) - Location's country `alt_country` (`str`) - Alternate country codes for location `admin1` (`str`) - FIPS code (subject to change to ISO code), ISO code for the US and CH `admin2` (`str`) - Code for the second administrative division, a county in the US `admin3` (`str`) - Code for third level administrative division `admin4` (`str`) - Code for fourth level administrative division `population` (`int`) - Location's population, if applicable `altitude` (`int`) - Location's elevation `gtopo30` (`int`) - Average elevation of 900 square metre region, if available `tzname` (`str`) - The timezone identifier using POSIX timezone names `modified_date` (`datetime.date`) - Location's last modification date in the geonames databases `timezone` (`int`) - The non-DST timezone offset from UTC in minutes Raises: `ValueError` - Unknown value for `angle` `ValueError` - Unknown value for units `ValueError` - Invalid value for latitude or longitude Overrides: object.__init__

### __str__(self, mode=`'``dd``'`) (Informal representation operator) |
Pretty printed location string
    >>> Stotfold = Location(2636782, "Stotfold", "Stotfold", None, 52.0,
    ...                     -0.2166667, "P", "PPL", "GB", None, "F8", None,
    ...                     None, None, 6245, None, 77, "Europe/London",
    ...                     datetime.date(2007, 6, 15))
    >>> print(Stotfold)
    Stotfold (N52.000°; W000.217°)
    >>> print(Stotfold.__str__(mode="dms"))
    Stotfold (52°00'00"N, 000°13'00"W)
    >>> print(Stotfold.__str__(mode="dm"))
    Stotfold (52°00.00'N, 000°13.00'W)
    >>> Stotfold.alt_names = ["Home", "Target"]
    >>> print(Stotfold)
    Stotfold (Home, Target - N52.000°; W000.217°)
Parameters: `mode` (`str`) - Coordinate formatting system to use Returns: `str` Human readable string representation of Location object Raises: `ValueError` - Unknown value for `mode` Overrides: object.__str__ See Also: trigpoints.point.Point