Created
October 7, 2019 09:01
-
-
Save wolframalpha/850b6d4fb4816e936288db10d848a1ff to your computer and use it in GitHub Desktop.
Check if a point is in the polygon
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
# please install shapely first by `pip install Shapely` | |
from shapely.geometry import Point | |
from shapely.geometry.polygon import Polygon | |
point = Point(0.5, 0.5) | |
polygon = Polygon([(0, 0), (0, 1), (1, 1), (1, 0)]) | |
# this return a bool | |
print(polygon.contains(point)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment