Skip to main content

No project description provided

Project description

GeoSol Research Logo

Pos (Position)

Geodetic position handling with lazy coordinate conversion between XYZ (ECEF) and LLA (Lat/Lon/Alt).

Overview

gri-pos provides the Pos class for working with geospatial positions. Initialize with either XYZ or LLA coordinates; the other representation is computed and cached on first access. Pos supports distance calculations, coordinate deltas, translations, and tolerance-based equality.

All coordinate types (XYZ, LLA, ENU, NED, AER) are numpy.ndarray subclasses, so they work directly in numpy and scipy operations.

Requires Python 3.14+.

Mathematical Background

Positions use the WGS-84 reference ellipsoid. LLA coordinates are geodetic latitude (degrees), longitude (degrees), and altitude above the ellipsoid (meters). XYZ coordinates are Earth-Centered, Earth-Fixed (ECEF) in meters. Conversion between LLA and XYZ uses iterative methods accurate to sub-millimeter precision.

Equality comparison uses per-coordinate tolerances: LLA defaults to ~1 cm accuracy (1e-7 degrees for lat/lon, 0.01 m for altitude).

Installation

pip install gri-pos

For development:

git clone https://gitlab.com/geosol-foss/python/gri-pos.git
cd gri-pos
. .init_venv.sh

Quick Start

from gri_pos import Pos

# Create from LLA or XYZ
p1 = Pos.LLA(40.0, -105.0, 1600.0)
p2 = Pos.XYZ(-1270367.0, -4800297.0, 4091069.0)

# Access either representation (lazy-computed)
print(p1.xyz)  # ECEF coordinates (meters)
print(p2.lla)  # Geodetic lat, lon, alt

# Distance calculations
dist = p1.dist_m(p2)                  # 3D Euclidean (meters)
surf = p1.dist_surface_m(p2)          # Vincenty surface distance
fast_surf = p1.dist_surface_simple_m(p2)  # Fast spherical approximation

# Coordinate deltas
enu = p1.delta_enu(p2)   # East, North, Up offset
aer = p1.delta_aer(p2)   # Azimuth, Elevation, Range

# Translation (create new position from offset)
p3 = p1.translate_enu([100, 200, 0])

Pos Class

Creating Positions

from gri_pos import Pos, XYZ, LLA

# Static constructors (preferred)
p = Pos.LLA(40.0, -105.0, 1600.0)
p = Pos.XYZ(-1270367.0, -4800297.0, 4091069.0)

# From existing objects
p = Pos(XYZ(-1270367.0, -4800297.0, 4091069.0))
p = Pos(LLA(40.0, -105.0, 1600.0))
p = Pos(other_pos)  # Copy

Distance Methods

Method Algorithm Accuracy
dist_m(other) 3D Euclidean (XYZ) Exact straight-line
dist_surface_m(other) Vincenty (oblate spheroid) ~0.5 mm
dist_surface_simple_m(other) Spherical approximation Good for <500 km

Delta and Translation

All delta/translate methods accept and return numpy-compatible types:

enu = p1.delta_enu(p2)    # Returns ENU (east, north, up)
ned = p1.delta_ned(p2)    # Returns NED (north, east, down)
aer = p1.delta_aer(p2)    # Returns AER (azimuth_deg, elevation_deg, range_m)
xyz = p1.delta_xyz(p2)    # Returns XYZ delta

p3 = p1.translate_enu(enu)
p3 = p1.translate_ned(ned)
p3 = p1.translate_aer(aer)

Coordinate Types

All types are numpy.ndarray subclasses with named attributes:

Type Attributes Units
XYZ x, y, z meters (ECEF)
LLA lat_deg, lon_deg, alt_m degrees, degrees, meters
ENU east, north, up meters
NED north, east, down meters
AER azim_deg, elev_deg, range_m degrees, degrees, meters

Dependencies

  • gri-utils: Coordinate conversion and distance functions
  • numpy: Array operations

Other Projects

Current list of other GRI FOSS Projects we are building and maintaining.

License

MIT License. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gri_pos-0.2.0.post1.tar.gz (36.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gri_pos-0.2.0.post1-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file gri_pos-0.2.0.post1.tar.gz.

File metadata

  • Download URL: gri_pos-0.2.0.post1.tar.gz
  • Upload date:
  • Size: 36.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for gri_pos-0.2.0.post1.tar.gz
Algorithm Hash digest
SHA256 3525713431180f379b2871ac14d302c674f74921cd5734da63b8339db1d16db7
MD5 1c1b6d445c45185e4693187e4a8467b7
BLAKE2b-256 62b6cf8f83d1b827d712e8deeb6ea33d76c110bac49277d6c6f3af3c3eb2a033

See more details on using hashes here.

File details

Details for the file gri_pos-0.2.0.post1-py3-none-any.whl.

File metadata

  • Download URL: gri_pos-0.2.0.post1-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for gri_pos-0.2.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 0c4f8b55f865ed1e5d7e699a68560dc43617427cb08b8d50ffd6b576e6fe1edd
MD5 e650e0a7b374e72d9e4cf1783f7ffe2f
BLAKE2b-256 10f6d4d4444833f6b6c63a7688fcf30f7ce65bf35f3f84e5b2a6cd68ba2ef76e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page