Module epsglide.dataset

epsglide.dataset.DATA

Path where json dataset are stored. On each EPSG dataset request, json data are stored on this local path to allow introspection when needed and faster execution.

DatasetConnexionError Objects

class DatasetConnexionError(Exception)

Exception raised when EPSG API is not available.

DatasetNotFound Objects

class DatasetNotFound(Exception)

Exception raised when API call status code is not 200.

DatasetIdentificationError Objects

class DatasetIdentificationError(Exception)

Exception raised when EpsgElement initialized with no info.

DatumInitializationError Objects

class DatumInitializationError(Exception)

Exception raised when unmanageable datum parameter occurs.

EpsgElement Objects

class EpsgElement(object)

Represents an EPSG dataset element.

Attributes:

  • _struct_ ctypes.Structure - object representing the structure of the equivalant C element.

Arguments:

  • code int - the EPSG code of the element.
  • name str - the name of the element.

Raises:

  • DatasetIdentificationError - if either EPSG code or name is not provided.
  • NotImplementedError - if searching by keyword is attempted (not implemented yet).

EpsgElement.__repr__

def __repr__()

Return a string representation of the EpsgElement object.

Returns:

  • str - a string representation of the object in the format <ClassName Code: Name>.

EpsgElement.populate

def populate()

Populate the EPSG dataset element. This method is meant to be overridden by subclasses.

Unit Objects

class Unit(EpsgElement)

Represents a unit in EPSG dataset.

Attributes:

  • ratio float - The ratio value of the unit.

Unit.from_target

def from_target(value: Union[int, float]) -> float

Convert a value to the dataset specific unit.

>>> u = epsglide.dataset.Unit(9003)
>>> u
<Unit 9003: US survey foot>
>>> u.from_target(1) # convert one metre into US survey foot
3.2808333333333333

Arguments:

  • value int|float - the value to be converted.

Returns:

  • float|None - the converted value, or None if no conversion is possible.

Unit.to_target

def to_target(value: Union[int, float]) -> float

Convert a value to computation specific units.

>>> u = epsglide.dataset.Unit(9002)
>>> u
<Unit 9002: foot>
>>> u.to_target(1) # convert one international feet into meters
0.3048

Arguments:

  • value int|float - the value to be converted.

Returns:

  • float|None - the converted value, or None if no conversion is possible.

PrimeMeridian Objects

class PrimeMeridian(EpsgElement)

Represents a prime meridian in EPSG dataset.

Attributes:

  • longitude float - The longitude value of the prime meridian.

Ellipsoid Objects

class Ellipsoid(EpsgElement)

Represents an ellipsoid model used in geodetic coordinate reference systems.

Methods:

  • populate - Populate the Ellipsoid object with necessary data, including parameters related to its shape and size.

Ellipsoid.populate

def populate()

Populate the Ellipsoid object with necessary data.

This method initializes the internal structure (_struct_) of the Ellipsoid object with information about its semi-major axis, semi-minor axis, flattening, eccentricity, and other related parameters.

The initialization process depends on whether the ellipsoid’s inverse flattening is provided or calculated from its semi-major and semi-minor axes.

GeodeticCoordRefSystem Objects

class GeodeticCoordRefSystem(EpsgElement)

Represents a geodetic coordinate reference system.

Methods:

  • populate - Populate the GeodeticCoordRefSystem object with necessary data, including datum and transformation parameters.

GeodeticCoordRefSystem.populate

def populate()

Populate the GeodeticCoordRefSystem object with necessary data.

This method initializes the internal structure (_struct_) of the GeodeticCoordRefSystem object with information about the datum, ellipsoid, prime meridian, and transformation parameters.

Raises:

  • DatasetNotFound - If no transformation is found for the given coordinate reference system (CRS) code.
  • DatumInitializationError - If an unmanageable transformation parameter is encountered during initialization.