| src | ||
| Cargo.lock | ||
| Cargo.toml | ||
| README.md | ||
Pipeline route calculation
A function that exposes the pipeline route calculations.
The pipeline route can be defined by various means
kmlroute filekmzroute filecsvof the x,y, and optionally z coordinates of the pipeline.
If the elevation is missing, we utilise one of the following services to obtain the elevation of each waypoint on the pipeline.
- Google maps
- Map box
- Open elevation
This function implements the calculation of this following part of the BPML:
flowchart LR
Start((Start))
Start --> KML{User upload .kml or .csv?}
KML -->|.kml| V("Calculate pipeline measures (Vincenty's Method) - Calculation #2")
KML -->|.csv| POS{Is position in UTM or Lat/Lon?}
POS -->|UTM| PROJ(Poject to Lat/Lon - Calculation #3)
PROJ --> MEAS
POS -->|Lat/Lon| MEAS{Does the file contain the measure?}
MEAS -->|no| V
MEAS -->|yes| Done
V --> Done((Done))
Input
Arguments
elevation_provider: astringvalue should be one of the following typesmapboxgoogle_mapsopen_elevation
pipeline_id: anarrayofstringswhich should each be a valid uuid representing a pipeline.route_file: anarrayofobjectscontaining the details of the uploaded file.
Note the pipeline_id array and route_file array should be the length such that the first entry in each array corresponds to one another.
Environment
ORG_ID: the organization idPROJECT_ID: the id of the data project where the pipeline data is foundENV: the environment of the platform e.g.devorstgetc.
Testing the function locally
You can run and test the function locally by running
cargo run
Then you can check it work with curl as follows
curl -X POST localhost:8080 -v \
-d "\"{\\\"elevation_provider\\\": \\\"open_elevation\\\", \\\"formData\\\": {\\\"elevationProvider\\\": \\\"open_elevation\\\", \\\"pipeline_datasetIds\\\": \\\"\\\", \\\"pipeline_organizationId\\\": \\\"2cbfe270-d195-48ad-aed1-24145924635c\\\", \\\"pipeline_resourceClientIds\\\": [], \\\"pipeline_resourceIds\\\": [], \\\"pipeline_resourceTypeId\\\": null, \\\"pipeline_workspaceId\\\": null, \\\"routeFile\\\": [{\\\"fileId\\\": \\\"a97c1871-b6b2-4ea0-8a04-43ae4c7d76e3\\\", \\\"revisionId\\\": \\\"975b4034-aad1-4e12-b531-fb0cf0b6f255\\\"}]}, \\\"input\\\": null, \\\"pipeline_id\\\": [\\\"0195a527-f16b-7d83-b936-35bc2dd92f9d\\\"], \\\"route_file\\\": [{\\\"fileId\\\": \\\"a97c1871-b6b2-4ea0-8a04-43ae4c7d76e3\\\", \\\"revisionId\\\": \\\"975b4034-aad1-4e12-b531-fb0cf0b6f255\\\"}]}\""