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.9 or higher
    • Poetry
    • black code formatter
  2. Clone this repository

  3. Install

    poetry install

Build and Test

Run in the project root folder:

poetry shell pytest 

Build the package wheel:

poetry build

Publish

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.10.tar.gz (6.6 kB view hashes)

Uploaded Source

Built Distribution

coordinate_projector-0.0.10-py3-none-any.whl (7.1 kB view hashes)

Uploaded Python 3

Supported by

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