Package upoints :: Module xearth :: Class Xearth
[hide private]
[frames] | no frames]

Class Xearth

 object --+    
          |    
point.Point --+
              |
             Xearth

Class for representing a location from a Xearth marker

Since: 0.2.0

Instance Methods [hide private]
 
__init__(self, latitude, longitude, comment=None)
Initialise a new Xearth 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__

Instance Variables [hide private]
  comment
Location's comment
  latitude
Location's latitude
  longitude
Locations's longitude

Inherited from point.Point: rad_latitude, rad_longitude, timezone, units

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, latitude, longitude, comment=None)
(Constructor)

 

Initialise a new Xearth object

>>> Xearth(52.015, -0.221, "James Rowe's house")
Xearth(52.015, -0.221, "James Rowe's house")
Parameters:
  • latitude (float or coercible to float) - Location's latitude
  • longitude (float or coercible to float) - Location's longitude
  • comment (str) - Comment for location
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

>>> print(Xearth(52.015, -0.221))
N52.015°; W000.221°
>>> print(Xearth(52.015, -0.221).__str__(mode="dms"))
52°00'54"N, 000°13'15"W
>>> print(Xearth(52.015, -0.221).__str__(mode="dm"))
52°00.90'N, 000°13.26'W
>>> print(Xearth(52.015, -0.221, "James Rowe's house"))
James Rowe's house (N52.015°; W000.221°)
Parameters:
  • mode (str) - Coordinate formatting system to use
Returns: str
Human readable string representation of Xearth object
Raises:
  • ValueError - Unknown value for mode
Overrides: object.__str__

See Also: point.Point