Skip to main content

Coordinate conversion, WGS84 navigation, and position fixing

Project description

NautiPy

Easy coordinate handling, trustworthy WGS84 navigation, and diagnosed position fixes in one Python package.

NautiPy accepts the coordinate formats people commonly paste or type, converts them into a validated Position, and provides navigation and position-fixing tools without silently guessing when an input is ambiguous.

Install

Use a Python version accepted by the requires-python setting, then install the complete package from PyPI:

python -m pip install nautipy

The installation includes GeographicLib, NumPy, and SciPy, so every feature is available immediately.

Quick start

Parse and convert coordinates

from nautipy import convert_position, parse_position

p1 = parse_position("50.12257, 8.66570")
p2 = parse_position("50° 7.3542' N; 8° 39.942' E")
p3 = parse_position("+50.12257+008.66570/")

assert p1 == p2 == p3
assert convert_position(
    "50.12257, 8.66570",
    to="dms",
) == "50° 7′ 21.25″ N; 8° 39′ 56.52″ E"

Detection covers decimal degrees (DD), degrees and decimal minutes (DDM), degrees/minutes/seconds (DMS), two-dimensional ISO 6709, and NMEA coordinate field pairs. Use order="lonlat" for unmarked longitude-first input. order="auto" accepts hard axis evidence or equivalent source orders; otherwise it raises AmbiguousCoordinateError.

Calculate WGS84 navigation values

from nautipy import destination, distance, inverse

start = "50.12257, 8.66570"
end = destination(start, bearing=90, distance=12_000)

assert abs(distance(start, end) - 12_000) < 1e-6

result = inverse(start, end)
print(result.initial_bearing)
print(result.final_bearing)

Distances are in metres and bearings are true degrees clockwise from north. Calculations use WGS84 ellipsoidal geodesics through GeographicLib.

Estimate a position from observations

from nautipy import Position, RangeObservation, solve_fix

references = (
    Position(50.116135, 8.670277),
    Position(50.112836, 8.666753),
    Position(50.110347, 8.659873),
)
ranges = tuple(
    RangeObservation(reference, measured, uncertainty=2.0)
    for reference, measured in zip(
        references,
        (1_275.251, 1_599.237, 1_917.145),
    )
)

result = solve_fix(ranges=ranges)
if result.success:
    print(result.position)
else:
    print(result.status, result.competing_positions)

Bearing, range, and mixed-observation fixes report residuals, convergence, and geometry diagnostics. A successful optimization does not by itself guarantee good observation geometry, so callers should inspect the complete result.

Use the command line

$ nautipy convert "50° 7.3542' N; 8° 39.942' E" --to dd
50.122570, 8.665700

$ nautipy inspect "+50.12257+008.66570/"

inspect writes deterministic JSON describing the detected format, normalizations, resolution, and candidate interpretations. python -m nautipy provides the same interface.

What is included

  • coordinate parsing, inspection, formatting, and conversion;
  • an immutable, validated Position model;
  • WGS84 distance, bearing, destination, interpolation, and nearest-position calculations;
  • diagnosed bearing, range, and mixed-observation fixes;
  • GeoJSON Point and FeatureCollection interchange; and
  • offline convert and inspect commands.

NautiPy is deliberately not a general GIS framework, charting application, route planner, live-data client, or certified navigation system.

Documentation

For using NautiPy:

For contributing and maintaining the project:

Please report ordinary bugs through the issue tracker. Report suspected security problems through the security policy. Participation is governed by the Code of Conduct.

NautiPy is available under the MIT License.

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

nautipy-0.1.0.tar.gz (116.8 kB view details)

Uploaded Source

Built Distribution

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

nautipy-0.1.0-py3-none-any.whl (50.3 kB view details)

Uploaded Python 3

File details

Details for the file nautipy-0.1.0.tar.gz.

File metadata

  • Download URL: nautipy-0.1.0.tar.gz
  • Upload date:
  • Size: 116.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for nautipy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5f31c90984e576d06b555f13414f349354633bc4fd47da7938fb7c364ae6bd96
MD5 b305527195e6528151ba04313a763748
BLAKE2b-256 7e0cab7fe8d96227ff0ea051473dcbb789b5f87c60d85e0e23a9420748caa76b

See more details on using hashes here.

Provenance

The following attestation bundles were made for nautipy-0.1.0.tar.gz:

Publisher: release.yml on cafawo/NautiPy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nautipy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nautipy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 50.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for nautipy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b065fc6dda3bb9debf9593a84cdddb3fbb6756dbf15aecec1b9b2921c6c81f09
MD5 9923f8942f03eea4f7f8b91f7c409420
BLAKE2b-256 7370d6954421978be7d5b103684cc8bcdfa4e40a1d184758c2d045872ae3abaa

See more details on using hashes here.

Provenance

The following attestation bundles were made for nautipy-0.1.0-py3-none-any.whl:

Publisher: release.yml on cafawo/NautiPy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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