Created
June 7, 2022 14:48
-
-
Save arbakker/c2f893cff4d59d7427b8cec6e5e7cae5 to your computer and use it in GitHub Desktop.
Retrieve geojson course layout udisc #discgolf #geojson #jq
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -e | |
| COURSE_ID=immerloo-park-6pMm | |
| curl -s "https://udisc.com/courses/${COURSE_ID}/map" | | |
| pup "body script:first-of-type text{}" | cut -d= -f2 | | |
| jq '[.courseDirectory.course.holes | to_entries[] | (.value.pathConfigurations[0] as $path | ({type: "Feature","geometry": {"type": "LineString","coordinates": [[($path.teePosition.longitude,$path.teePosition.latitude)], ($path.doglegs[] | [.longitude,.latitude]),[($path.targetPosition.longitude,$path.targetPosition.latitude)]]},"properties": {"holenr": [.key | tonumber ,1] | add}}))]' | | |
| xargs -0 -I {} echo "{\"type\": \"FeatureCollection\",\"features\": {}}" | | |
| jq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment