Skip to content

Instantly share code, notes, and snippets.

@simo97
Created September 5, 2021 18:12
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 simo97/c75dd787bd8fc16fc124ae610b7a4a25 to your computer and use it in GitHub Desktop.
Save simo97/c75dd787bd8fc16fc124ae610b7a4a25 to your computer and use it in GitHub Desktop.
Check if a point(lat, long) is contained into a square (BBOX) knowing his max and min coordinates
def is_into_square(latMin, latMax, longMin, longMax, lat , long) -> bool:
"""
This function check if a point(lat, long) is contained into a square (BBOX) knowing his max and min coordinates
:param latMin: min latitude of the BBOx
:param latMax: max latitude of the BBOx
:param longMin: max longitude of the BBOx
:param longMax: max longitude of the BBOx
:param lat: the latitude of the point to verified
:param long: the longitude of the point to be verified
:return: bool
"""
if long >= longMin and long <=longMax:
if lat >= latMin and lat <= latMax:
return True
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment