Skip to main content

Library for transformation and conversion of coordinates used in Equinor.

Project description

Geodetic Engine

A Python library using the Equinor Geodetic Engine API and pyproj to transform coordinates between different Coordinate Reference Systems (CRS).

Installation

  1. You need access to Equinor Geodetic Engine API, given through AccessIT

  2. A personal subscription key is required to authenticate through APIM. Sign in to api.equinor.com and subscribe to Enterprise

  3. As usual it´s installed running pip install:

pip install -i https://test.pypi.org/simple/ geodeticengine

Authentication

There are two ways to authenticate:

  • User access - MSAL Device code flow
  • Application access - MSAL Client credential flow

User-based authentication using MSAL Device code flow

When user authentication is necessary, the app generates a code and prompts the user to visit a specific URL. At the webpage, the user is asked to enter the code provided by the app. From there, the webpage will guide the user through the standard authentication and login process.

To use the package with user-based access, you will need to add the following environment variables to your system:

EGE_CLIENT_ENVS=prod;test
EGE_TENANT_ID=3aa4a235-b6e2-48d5-9195-7fcf05b459b0
EGE_RESOURCE_IDS=c25018ed-b371-4b37-ba4e-4d902aee2b6c;84c8d2ec-6294-47aa-8fd4-f69c870faa3a
EGE_SUBS_KEYS=<your-subscription-key-for-geodeticengine-prod;your-subscription-key-for-geodeticengine-test>

EGE_CLIENT_ENVS sets the order of environment variables. If you only have access to "prod", simply add "prod" to this variable.
EGE_TENANT_ID is the tenant ID (Equinor).
EGE_SUBS_KEYS is your APIM subscription keys for each environment (prod and test). This will allow the package to access the resources you have permission to use.
EGE_RESOURCE_IDS is the resource ID of the geodetic engine for the specified environments.

Application access - MSAL Client credential flow

To use the package with application-based access, you will need to add the following environment variables to your system:

  • EGE_CLIENT_IDS
  • EGE_CLIENT_SECRETS

Add the following environment variables to your system:

EGE_TENANT_ID=3aa4a235-b6e2-48d5-9195-7fcf05b459b0
EGE_CLIENT_ENVS=prod;test
EGE_CLIENT_IDS=<your-app-id-prod;your-app-id-test>
EGE_RESOURCE_IDS=c25018ed-b371-4b37-ba4e-4d902aee2b6c;84c8d2ec-6294-47aa-8fd4-f69c870faa3a
EGE_SUBS_KEYS=<your-subscription-key-for-geodeticengine-prod;your-subscription-key-for-geodeticengine-test>
EGE_CLIENT_SECRETS=<your-app-secret-prod;your-app-secret-test>

When EGE_CLIENT_SECRETS is added, the authorization class will automatically use Application Access to authenticate.

Access test environment

To use the package to access Geodetic Engine Test environment, you need to set the EGE_API_ENV as an environment variable. If this environment variable is not set, the package will use the production environment.

EGE_API_ENV=test

Token cache

The token for each environment is cached and stored in the user's home directory, eliminating the need to authenticate before every session. Although an access token expires after one hour, the presence of a cached Refresh Token allows a new Access Token to be obtained without requiring re-authentication. The Refresh Token lasts for 90 days, then you have to log in again.

Code example

from geodeticengine import CoordTrans

point_in_4230 = [[10,60]]
point_in_4326 = [[9.99860677505385, 59.999554562447024]]
crs_from = "EPSG:4230"
crs_to = "EPSG:4326"
trans = "EPSG:1612"
ct = CoordTrans(crs_from=crs_from, crs_to=crs_to, trans=trans, points=point_in_4230)
print(ct.transform_pointlist_forward())

# Get pipleline
ct = CoordTrans(crs_from=crs_from, crs_to=crs_to, trans=trans)
print(ct.get_pipeline_forward())

# Inverse transformation
ct = CoordTrans(crs_from=crs_from, crs_to=crs_to, trans=trans, points=point_in_4326)
print(ct.transform_pointlist_inverse())

# Transform coordinates using pipeline
ct = CoordTrans(crs_from=crs_from, crs_to=crs_to, trans=trans)

pipeline_forward = ct.get_pipeline_forward()
print(ct.transform_from_pipeline(point_in_4230, pipeline_forward))

pipeline_inverse = ct.get_pipeline_inverse()
print(ct.transform_from_pipeline(point_in_4326, pipeline_inverse))

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

geodeticengine-0.3.7.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

geodeticengine-0.3.7-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file geodeticengine-0.3.7.tar.gz.

File metadata

  • Download URL: geodeticengine-0.3.7.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for geodeticengine-0.3.7.tar.gz
Algorithm Hash digest
SHA256 8fbd5fe0d624d0e33378eb4489f168f4a90071239c1692edf414a24dcca43b23
MD5 a16d6f193782053be9a0c14a29c4a405
BLAKE2b-256 21f6349a898d6356d0eccc2f09809a6de12c625c0946b68da3b8c0ef04f4e395

See more details on using hashes here.

File details

Details for the file geodeticengine-0.3.7-py3-none-any.whl.

File metadata

File hashes

Hashes for geodeticengine-0.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 e36208306f0bcfc9d95d06606ceca727d149127cf1cad1c1fc93cc40c440ddfd
MD5 c3b83a0f3a6ba6aede97f6bd8a9a2502
BLAKE2b-256 70dc9329413e1ab14dd883592323f75b02169cc3a88ecd6dc08ec1ab2c2870b1

See more details on using hashes here.

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