Last active
April 5, 2023 15:22
-
-
Save jsundram/1251783 to your computer and use it in GitHub Desktop.
Check if lat long is inside the bounds of the continental US (box model, not shape)
This file contains 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
# http://en.wikipedia.org/wiki/Extreme_points_of_the_United_States#Westernmost | |
top = 49.3457868 # north lat | |
left = -124.7844079 # west long | |
right = -66.9513812 # east long | |
bottom = 24.7433195 # south lat | |
def cull(latlngs): | |
""" Accepts a list of lat/lng tuples. | |
returns the list of tuples that are within the bounding box for the US. | |
NB. THESE ARE NOT NECESSARILY WITHIN THE US BORDERS! | |
""" | |
inside_box = [] | |
for (lat, lng) in latlngs: | |
if bottom <= lat <= top and left <= lng <= right: | |
inside_box.append((lat, lng)) | |
return inside_box | |
I honestly did not expect an answer this useful from one web search. Thanks!
I searched for coal and found Diamond and gold from this first visited link.
I was looking for this only
top = 49.3457868 # north lat
left = -124.7844079 # west long
right = -66.9513812 # east long
bottom = 24.7433195 # south lat
and wiki link is also good
Thank you!
Great find and thank you!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
THANK YOU!