Skip to main content

Polar to WGS84 Converter

image

Quality gate

Coverage

Lines of Code

Global geometry processing utilities for GeoJSON-safe WGS84 polygons.

Stable release

To install Polar to WGS84 Converter, run this command in your terminal:

$ pip install git+https://gitlab.cnes.fr/pdssp/common/polar2wgs84.git

This is the preferred method to install Polar to WGS84 Converter, as it will always install the most recent stable release.

If you don't have pip installed, this Python installation guide can guide you through the process.

Installing UV

To manage the dependencies of Polar to WGS84 Converter, we use [UV](https://docs.astral.sh/uv/). If you don't have UV installed, follow these steps:

  1. Install UV:

    $ curl -LsSf https://astral.sh/uv/install.sh | sh
    
  2. Verify the installation:

    $ uv --version
    

Please note that this project has been tested with UV version 0.9.15.

From sources

The sources for Polar to WGS84 Converter can be downloaded from the Gitlab repo.

You can either clone the public repository:

$ git clone https://gitlab.cnes.fr/pdssp/common/polar2wgs84.git

Or download the tarball:

$ curl -OJL https://gitlab.cnes.fr/pdssp/common/polar2wgs84/tarball/main

Once you have a copy of the source, you can install it with:

$ make  # install

Development

$ git clone polar2wgs84.git
$ cd polar2wgs84
$ make prepare-dev
$ source .venv/bin/activate
$ make install-dev

To get more information about the preconfigured tasks:

$ make help

Usage

To use Polar to WGS84 Converter in a project:

from polar2wgs84 import Footprint
from shapely import Polygon

# Define the vertices of your spherical polygon as a list of (longitude, latitude) tuples.
# Example: A polygon with 4 vertices (e.g., a rectangle near the North Pole).
polygon_vertices = [
    (longitude_1, latitude_1),  # First vertex
    (longitude_2, latitude_2),  # Second vertex
    (longitude_3, latitude_3),  # Third vertex
    (longitude_4, latitude_4),  # Fourth vertex
    (longitude_1, latitude_1),  # Close the polygon by repeating the first vertex
]

# Create a Shapely Polygon from the vertices
polygon = Polygon(polygon_vertices)

# Instantiate the Footprint class with the polygon
footprint = Footprint(polygon)

# Convert the polygon to a valid GeoJSON-compatible geometry.
# This ensures the geometry is either a Polygon or MultiPolygon,
# which are the only types supported by the GeoJSON standard.
valid_geom = footprint.make_valid_geojson_geometry()

# Interpolate the geometry to the Plate Carrée (CAR) projection (EPSG:4326)
# and simplify it to reduce complexity while preserving its shape.
# This is useful for visualization and further processing.
simplified_valid_geom = footprint.to_wgs84_plate_carre(valid_geom)
# Additional arguments can be provided to control polygon densification and geometry simplification.

With command line:

$ polar2wgs84 -h

Run tests

To run automatic tests

$make tests

To run manual tests

pytest -m "manual" -s

Documentation

The documentation is automatically deployed on https://pdssp.io.cnes.fr/polar2wgs84 based on main branch

Container

A container is automatically created on https://gitlab.cnes.fr/pdssp/common/polar2wgs84/container_registry

Author

👤 Jean-Christophe Malapert

🤝 Contributing

Contributions, issues and feature requests are welcome!<br />Feel free to check [issues page](https://gitlab.cnes.fr/pdssp/common/polar2wgs84/issues). You can also take a look at the [contributing guide](https://gitlab.cnes.fr/pdssp/common/polar2wgs84/blob/main/CONTRIBUTING.rst)

📝 License

This project is [Apache V2.0](https://gitlab.cnes.fr/pdssp/common/polar2wgs84/blob/main/LICENSE) licensed.

Download files

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

Source Distribution

polar2wgs84-1.0.2.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

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

polar2wgs84-1.0.2-py3-none-any.whl (32.7 kB view details)

Uploaded Python 3

File details

Details for the file polar2wgs84-1.0.2.tar.gz.

File metadata

  • Download URL: polar2wgs84-1.0.2.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for polar2wgs84-1.0.2.tar.gz
Algorithm Hash digest
SHA256 53262396eea5996bfe9f9bf0a4718c38d570743ad7e6a376c1c735ff36b8c94b
MD5 f2632bc77984fa8bad693c0de951dae9
BLAKE2b-256 32983dd75c58ef0301b2dbd370731b657337d1fd1dcc33c1d0dcbe1cb78bab37

See more details on using hashes here.

Provenance

The following attestation bundles were made for polar2wgs84-1.0.2.tar.gz:

Publisher: ci.yml on pdssp/polar2wgs84

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

File details

Details for the file polar2wgs84-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: polar2wgs84-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 32.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for polar2wgs84-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 56d824dc7850900230ace4746d6b6fd9170a3f05c7b2be70b55478026109647a
MD5 b0609103a7c72085ca15bf67d6d59811
BLAKE2b-256 8db678ac906ac98a50eb3e92bf5e9a730fa5a395d3004c27907fba11b629106a

See more details on using hashes here.

Provenance

The following attestation bundles were made for polar2wgs84-1.0.2-py3-none-any.whl:

Publisher: ci.yml on pdssp/polar2wgs84

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

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page