Skip to main content

Project points from one projection to another using pyproj

Project description

Coordinate Projector

security: bandit

This is the Norwegian Geotechnical Institute (NGI) Python package for projecting coordinates. It is a small shim on top of the library pyproj that again is an interface to PROJ.

References:

Latest releases see CHANGES.md

Installation (end user)

pip install coordinate-projector

Basic usage

Project a point

from coordinate_projector import Projector

projector = Projector()
 
from_srid = "4326"
to_srid = "3857"

# Paris Lat(48.8589506) Lon(2.2768485) EPSG:4326
from_east, from_north = 2.2768485, 48.8589506 

projected_east, projected_north = projector.transform(from_srid, to_srid, from_east, from_north)

# Paris Lat(6250962.06) Lon(253457.62) EPSG:3857 is in metres - 2D projection
assert abs(projected_east - 253457.62) <= 0.01
assert abs(projected_north - 6250962.06) <= 0.01 

print(f"{projected_east=}, {projected_north=}")
# projected_east=253457.6156334287, projected_north=6250962.062720417

Getting Started developing

  1. Software dependencies

    • Python 3.10 or higher
    • uv
    • Ruff code formatter
  2. Clone this repository

  3. Install

    uv sync --all-extras --dev

Build and Test

Run in the project root folder:

uv run pytest 

Build the package wheel:

uv build

Publish

Publish the package to PyPi:

uv publish --token ${PYPI_TOKEN}

TODOs

  • Handle lines
  • Handle polygons

Contribute

Please start by adding an issue before submitting any pull requests.

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

coordinate_projector-0.0.15.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

coordinate_projector-0.0.15-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file coordinate_projector-0.0.15.tar.gz.

File metadata

  • Download URL: coordinate_projector-0.0.15.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for coordinate_projector-0.0.15.tar.gz
Algorithm Hash digest
SHA256 2cea9c415d891d86caf455dee0e8ff34e83b7a607409263e0e6903ae2c9b5129
MD5 1c893f5f767a1c9b080827551959dd0b
BLAKE2b-256 5cd22049b9365e2da56a68aa0b62435eed62763dc9df4c962436810115adad32

See more details on using hashes here.

Provenance

The following attestation bundles were made for coordinate_projector-0.0.15.tar.gz:

Publisher: release.yaml on norwegian-geotechnical-institute/coordinate-projector

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

File details

Details for the file coordinate_projector-0.0.15-py3-none-any.whl.

File metadata

File hashes

Hashes for coordinate_projector-0.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 6943f8eadf49355976027d87528c219dac2f3641aaf45ef5dfdc91fda7078f78
MD5 f265eaf4516928fb4d8e9d76326ccacd
BLAKE2b-256 0d7d83eb128e2bcfa2edcab15a39098022eaeee52b730d6a76ba62f0526c7497

See more details on using hashes here.

Provenance

The following attestation bundles were made for coordinate_projector-0.0.15-py3-none-any.whl:

Publisher: release.yaml on norwegian-geotechnical-institute/coordinate-projector

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