Input Formats¶
This module is used as a base for parsing input files.
The main class is formats.Parser
.
Each input format module has a child class named FormatParser(Parser).
Classes¶
- class formats.Point(*args)¶
Bases:
pygeoif.geometry.Point
- class formats.LineString(coordinates)¶
Bases:
pygeoif.geometry.LineString
- class formats.Feature(geom, desc, id=None, **properties)¶
Bases:
pygeoif.geometry.Feature
A GeoJSON-like Feature object.
- property geometry¶
- property desc¶
Return the desc property
- property point_name¶
Return the point_name property
- class formats.FeatureCollection(features)¶
Bases:
pygeoif.geometry.FeatureCollection
- class formats.Parser(data)¶
Bases:
object
Parses a single string of raw data.
This means that if you plan to load data from a file you have to pass the output of open(file).read() to this class.
- Parameters
data (str) – A string representing the file to be parsed.
- Variables
data (str) – A string representing the file to be parsed could be overridden by the init method.
- is_point(line)¶
Action for finding which parts of the source file are points.
This method must be overridden in the child class to have a working parser.
- Returns
A boolean
- get_point(line)¶
Action for getting points from source file.
This method must be overridden in the child class to have a working parser.
- Returns
A
formats.Feature
object.
- split_points()¶
Action for splitting points.
Defaults to
splitlines()
because most formats have one point per line.Override this method if the format is different.
- build_linestring()¶
Join all Point objects into a LineString.
- Returns
A
formats.LineString
object.
- property points¶
Action for parsing a source file and for finding points.
This method could be overridden in the child class to have a working parser.
- Returns
A list of GeoJSON-like Feature object representing points coordinates.
- property raw_line¶
Action for parsing a source file and for retrieving raw data.
This method must be overridden in the child class to have a working parser.
- Returns
A list of GeoJSON-like Feature object representing representing raw data i.e. polar coordinates and other informations.
- formats.check_coordorder(coordorder)¶
Check if coordinates order is valid.
- Parameters
coordorder (str) – A string representing the type of coordinates i.e. NEZ or ENZ.
Constants¶
- formats.BUILTIN_INPUT_FORMATS¶
Dictionnary that holds all input formats available in Total Open Station.
Form of the dictionnary :
{
‘parser_name’: (‘module_parser_name’, ‘FormatParser’, ‘Parser Name’),
}
- formats.UNITS_CIRCLE¶
Dictionnary that holds angle corresponding to the complet ride of a circle per units.
Form of the dictionnary :
{
‘name’: numeric value of complet ride,
}
- formats.UNKNOWN_STATION¶
formats.Point
that holds arbitary coordinates of an unknown station.
These coordinates are not egals to zero to avoid negativ coordinates during computation.Point(10000, 10000, 100)
- formats.UNKNOWN_POINT¶
formats.Point
that holds arbitary coordinates of an unknown point.
These coordinates are negatives to be able to check them during computation.Point(-1, -1, -1)
- formats.COORDINATE_ORDER¶
tuple that holds possible coordinates order in some input formats.
(‘NEZ’, ‘ENZ’)