Skip to content

Instantly share code, notes, and snippets.

@IReese
Last active November 8, 2019 02:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IReese/00073a06283f6ab5ac41bb2b1d5f7dfa to your computer and use it in GitHub Desktop.
Save IReese/00073a06283f6ab5ac41bb2b1d5f7dfa to your computer and use it in GitHub Desktop.
#!/bin/bash
A_json=./world_all_test.json
B_json=./gizzy_full_extent_test.json
#extract coord for world poly
Aulx=$( jq .coordinates[0][0][0] $A_json )
Auly=$( jq .coordinates[0][0][1] $A_json )
Alrx=$( jq .coordinates[0][2][0] $A_json )
Alry=$( jq .coordinates[0][2][1] $A_json )
echo "world bbox: upper left("$Aulx","$Auly"), lower right("$Alrx","$Alry")"
#extract coord for inside poly testing
Bulx=$( jq .coordinates[0][0][0] $B_json )
Buly=$( jq .coordinates[0][0][1] $B_json )
Blrx=$( jq .coordinates[0][2][0] $B_json )
Blry=$( jq .coordinates[0][2][1] $B_json )
echo "inside bbox: upper left("$Bulx","$Buly"), lower right("$Blrx","$Blry")"
#test if gizzy poly is touching a web mercator poly
if (( $(echo "$Bulx > $Aulx" | bc -l) )); then
echo "A poly is within a B poly x-range."
if (( $(echo "$Buly < $Auly" | bc -l) )); then
echo "A poly and B poly are properly touching each other."
fi
else
echo "Nope, no touch. Move on."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment