trigpoints - Imports trigpoint marker files.

class upoints.trigpoints.Trigpoint(latitude, longitude, altitude, name=None, identity=None)[source]

Bases: upoints.point.Point

Class for representing a location from a trigpoint marker file.


Although this class stores and presents the representation of altitude it doesn’t take it in to account when making calculations. For example, consider a point at the base of Mount Everest and a point at the peak of Mount Everest the actual distance travelled between the two would be considerably larger than the reported value calculated at ground level.

New in version 0.2.0.

Initialise a new Trigpoint object.

  • latitude (float) – Location’s latitude
  • longitude (float) – Location’s longitude
  • altitude (float) – Location’s altitude
  • name (str) – Name for location
  • identity (int) – Database identifier, if known
class upoints.trigpoints.Trigpoints(marker_file=None)[source]

Bases: upoints.point.KeyedPoints

Class for representing a group of Trigpoint objects.

New in version 0.5.1.

Initialise a new Trigpoints object.


Import trigpoint database files.

import_locations() returns a dictionary with keys containing the trigpoint identifier, and values that are Trigpoint objects.

It expects trigpoint marker files in the format provided at alltrigs-wgs84.txt, which is the following format:

I  GPSU 4.04,
S SymbolSet=0
W,500936,N52.066035,W000.281449,    37.0,Broom Farm
W,501097,N52.010585,W000.173443,    97.0,Bygrave
W,505392,N51.910886,W000.186462,   136.0,Sish Lane

Any line not consisting of 6 comma separated fields will be ignored. The reader uses the csv module, so alternative whitespace formatting should have no effect. The above file processed by import_locations() will return the following dict object:

{500936: point.Point(52.066035, -0.281449, 37.0, "Broom Farm"),
 501097: point.Point(52.010585, -0.173443, 97.0, "Bygrave"),
 505392: point.Point(51.910886, -0.186462, 136.0, "Sish Lane")}
Parameters:marker_file (iter) – Trigpoint marker data to read
Returns:Named locations with Trigpoint objects
Return type:dict
Raises:ValueError – Invalid value for marker_file