0

I am currently on a tutorial regarding Python GIS. There's an exercise that asks to create a function that takes a list of Shapely Point objects as a parameter and returns a LineString object of those input points. The function should first check that the input list really contains Shapely Point(s). What I did is this.

from shapely.geometry import LineString

def createLineGeom(points):
    for i in points:
        if str(type(i)) == "<class 'shapely.geometry.point.Point'>":
            pass
        else:
            return print(f'Invalid input: Type not shapely Point, {i}')
    return LineString(points)

Can someone show me a more appropriate way of checking if the input is a shapely point object? Thanks

0 Answers0