def get_vertices_for_geom(geom: ogr.Geometry) -> List[List[float]]: """ Gets a list of the vertices for the given geometry. :param geom: The geomery from which points are to be extracted. :type geom: :py:class:`ogr.Geometry` :return: A list of points that compose the geometry. :rtype: ``[[int, int]]`` """ vertices = [] geom_name = geom.GetGeometryName() if geom_name == 'POINT': vertices.append([geom.GetPoint()[0], geom.GetPoint()[1]]) elif geom_name == 'LINEARRING': num_vertices = geom.GetPointCount() for i in range(0, geom.GetPointCount()): point = geom.GetPoint(i) vertices.append([point[0], point[1]]) else: geom_count = geom.GetGeometryCount() for i in range(0, geom_count): geom_ref = geom.GetGeometryRef(i) verts = get_vertices_for_geom(geom_ref) vertices.append(verts) return vertices
def point_intersects_roi(point: PointData, region_of_interest: ogr.Geometry): for i in range(region_of_interest.GetGeometryCount()): sub_geom = region_of_interest.GetGeometryRef(i) intersects = sub_geom.Intersects(point.geometry) if intersects: result = True break else: result = False return result