TAMN module

TAMN module

The tamn module is a wrapper to the TAMN web service, and provides additional functions for handling GeoJSON LineString geometry type, and to derive boundary box coordinates of GeoJSON Geometry, and whether or not this geometry is crossing the target body’s antimeridian, North Pole and South Pole.

Note

TAMN_DEFAULT_RADIUS and TAMN_DEFAULT_POLE_DISTANCE values might need to be adapted to the target body. Currently yielding good results for Earth, Mars and Phobos.

geogen.tamn.TAMN_URL = 'http://localhost:3333/'

Default TAMN web service end-point URL.

geogen.tamn.TAMN_DEFAULT_RADIUS = 50000

Default radius (m) used in TAMN algorithm.

geogen.tamn.TAMN_DEFAULT_POLE_DISTANCE = 500000

Default pole distance (m) used in TAMN algorithm.

geogen.tamn.sort_frustum(frustum)[source]

Sort frustum.

Parameters

frustum (list) – set of surface points originating from a target body center (for example: [ [x1, y1, z1], [x2, y2, z2], [x3, y3, z3], [x4, y4, z4] ]).

Return type

list

geogen.tamn.in_frustum(vec, frustum)[source]

Returns whether or not a vector is contained within a frustum.

Parameters
  • vec (list) – 3d-vector representing a surface point, expressed in cartesian coordinates.

  • frustum (list) – set of surface points originating from a target body center.

Return type

bool

geogen.tamn.get_bbox(geometry)[source]

Returns the boundary box coordinates of an input GeoJSON Geometry objects, and whether or not this geometry is crossing the antimeridian, North Pole and South Pole.

Parameters

geometry (GeoJSON Geometry) – Input GeoJSON Geometry object.

Return type

Tuple[List[float], bool, bool, bool]

geogen.tamn.crossing(p1, p2)[source]

Returns whether or not two surface points, defining a line, crosses the antimeridian (+/ 180 degrees).

Parameters
  • p1 (list) – Latitudinal coordinates of first point defining a line ([lon, lat]).

  • p2 (list) – Latitudinal coordinates of second point defining a line ([lon, lat]).

Return type

bool

geogen.tamn.split_line(line)[source]

Returns split line, which can be a collection lines.

Parameters

line (list) – Input line, which consists of two points latitudinal coordinates ([lon, lat]).

Return type

List[list]

geogen.tamn.getSplitLineString(feature)[source]

Returns split GeoJSON Feature of LineString geometry type.

Other geometry types are handled by the getSplitLineString TAMN wrapper function.

Parameters

feature (GeoJSON Feature) – Input GeoJSON Feature object of LineString geometry type.

Return type

GeoJSON Feature

geogen.tamn.getSplitFeature(feature)[source]

Returns split GeoJSON Feature geometry.

Wrapper to the TAMN web service. Feature of LineString geometry are handled independantly of TAMN by the getSplitLineString function.

Parameters

feature (GeoJSON Feature) – Input GeoJSON Feature object to split.

Return type

GeoJSON Feature

geogen.tamn.splitGeoJSON(in_geojson_file, out_geojson_file)[source]

Split geometry within an input GeoJSON file.

Parameters
  • in_geojson_file – Input GeoJSON file path.

  • out_geojson_file – Output GeoJSON file path.

geogen.tamn.check_tamn_server()[source]

Check connectivity of TAMN server application.

Returns

Whether or not server application is working, server error code and message.

Return type

Tuple[bool, int, str]