xearth
¶
xearth - Imports xearth-style marker files.
-
class
upoints.xearth.
Xearth
(latitude, longitude, comment=None)[source]¶ Bases:
upoints.point.Point
Class for representing a location from a Xearth marker.
New in version 0.2.0.
Initialise a new
Xearth
object.Parameters:
-
class
upoints.xearth.
Xearths
(marker_file=None)[source]¶ Bases:
upoints.point.KeyedPoints
Class for representing a group of
Xearth
objects.New in version 0.5.1.
Initialise a new
Xearths
object.-
import_locations
(marker_file)[source]¶ Parse Xearth data files.
import_locations()
returns a dictionary with keys containing the xearth name, and values consisting of aXearth
object and a string containing any comment found in the marker file.It expects Xearth marker files in the following format:
# Comment 52.015 -0.221 "Home" # James Rowe's home 52.6333 -2.5 "Telford"
Any empty line or line starting with a ‘#’ is ignored. All data lines are whitespace-normalised, so actual layout should have no effect. The above file processed by
import_locations()
will return the followingdict
object:{'Home': point.Point(52.015, -0.221, "James Rowe's home"), 'Telford': point.Point(52.6333, -2.5, None)}
Note
This function also handles the extended xplanet marker files whose points can optionally contain added xplanet specific keywords for defining colours and fonts.
Parameters: marker_file (iter) – Xearth marker data to read Returns: Named locations with optional comments Return type: dict
-