Package: geodeticengine
Geodetic EngineA Python library using the Equinor Geodetic Engine API and pyproj to transform coordinates between different Coordinate Reference Systems (CRS).InstallationAccess to theEquinor Geodetic Engine APIis required, which can be obtained throughAccessIT.A personal subscription key is also necessary to authenticate through APIM. Sign in toapi.equinor.comand subscribe toEnterprise.As usual the package it´s installed running pip install:pip install geodeticengineAuthenticationThere are two ways to authenticate:User access - MSAL Device code flowApplication access - MSAL Client credential flowUser access - MSAL Device code flowThis package uses thePublicClientApplicationPython class from the MSAL library for user authentication. Bearer tokens are retrieved using theacquire_token_interactive()method, which can be accessed via a local browser on devices that support a Graphical User Interface (GUI). If a device lacks GUI support, such as GitHub Code Spaces, theinitiate_device_flow()method generates a specific URL for the user to visit and follows a standard authentication and login process.To use the package with user access to production, you will only need to add one environment variable to your system:EGE_SUBS_KEYS=<your-subscription-key-for-geodeticengine-prod>To use the package with user access to test, you will need to add the following environment variables to your system:EGE_CLIENT_ENVS=prod;test
EGE_SUBS_KEYS=<your-subscription-key-for-geodeticengine-prod>;<your-subscription-key-for-geodeticengine-test>
EGE_CLIENT_IDS=<ege-app-id-prod>;<ege-app-id-test>
EGE_API_ENV=testEGE_CLIENT_ENVS:This variable determines the order of environment variables. If you only have access to "prod", simply add "prod" to this variable.EGE_SUBS_KEYS:This variable holds your APIM subscription key for each environment (prod and test). This will allow the package to access the resources you have permission to use.EGE_CLIENT_IDS:In this context, this variable refers to the Geodetic Engine application (client) ID for each environment.EGE_API_ENV:This variable is used to access the Geodetic Engine Test environment. If this environment variable is not set, the package will use the production environment by default.User access - Token cacheThe 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.Application access - MSAL Client credential flowTo use the package with application access, you will need to add the following environment variables to your system:EGE_CLIENT_ENVS=prod;test
EGE_CLIENT_IDS=<your-app-id-prod>;<your-app-id-test>
EGE_CLIENT_SECRETS=<your-app-secret-prod>;<your-app-secret-test>
EGE_SUBS_KEYS=<your-subscription-key-for-geodeticengine-prod>;<your-subscription-key-for-geodeticengine-test>
EGE_RESOURCE_IDS=c25018ed-b371-4b37-ba4e-4d902aee2b6c;84c8d2ec-6294-47aa-8fd4-f69c870faa3aEGE_CLIENT_ENVS:This variable determines the order of environment variables. If you only have access to "prod", simply add "prod" to this variable.EGE_CLIENT_IDS:In in this context, this variable holds your application (client) ID for each environment.EGE_CLIENT_SECRETS:This variable is used for your application's client secret for each environment. If this variable is not set, the package will automatically fall back to user access for authentication.EGE_SUBS_KEYS:This variable holds your APIM subscription key for each environment (prod and test). This will allow the package to access the resources that you have permission to use.EGE_RESOURCE_IDS:This variable refers to the Geodetic Engine application (client) IDs for the specified environments.Transformation gridsTransformation grids are essential for achieving high accuracy when performing datum transformations. The package will automatically fetch required grid if it doesn't already exist on your local machine.More information on the data available is located inpyproj documentation.Code examplefrom geodeticengine import CoordTrans

### Example 1
points = [[10, 60]]
crs_from = "EPSG:4230"
crs_to = "EPSG:4326"
ct_from = "EPSG:1612"

# Transform coordinates
ct = CoordTrans(crs_from=crs_from, crs_to=crs_to, ct_from=ct_from, points=points)
print(f"Transformed coordinates:{ct.transform_pointlist()}")

# Get transformation pipeline
pipeline = ct.get_pipeline()
print(f"Transformation pipeline: {pipeline}")


### Example 2
points = [[9,65],[12,70]]
crs_from = "ST_ED50_T1133"
crs_to = "ST_WGS84_G4326"

# Transform coordinates
ct = CoordTrans(crs_from=crs_from, crs_to=crs_to, points=points)
print(f"Transformed coordinates:{ct.transform_pointlist()}")

# Get transformation pipeline
pipeline =  ct.get_pipeline()
print(f"Transformation pipeline: {pipeline}")