def test_point_in_polygon(): point_test = (50, 50) polygon = np.array([[10, 10,], [100, 10], [100, 100], [50, 150], [10, 100]]) print myg.point_in_polygon(point_test, polygon) assert myg.point_in_polygon(point_test, polygon)
def check_region(pos, regions): selected_region = None if pos[1] > 0: for region in regions: within_region = myg.point_in_polygon( pos, regions[region]['vertices']['wcs']) if within_region: selected_region = region within_region = False result = selected_region return result
def check_region(pos, regions): selected_region = None if pos[1] > 0: for region in regions: within_region = myg.point_in_polygon(pos, regions[region]['vertices']['wcs']) if within_region: selected_region = region within_region = False result = selected_region return result