I'm trying to create a linestring out of a dataframe of latitudes and longitudes.
geometry = [Point(xy) for xy in zip(linkdf.lon, linkdf.lat)] linkgdf = GeoDataFrame(linkdf, geometry=geometry) linkdf_line = linkgdf.groupby(['linkId'])['geometry'].apply(lambda x: x.tolist()) linkdf_line = linkdf_line.apply(lambda x: LineString(x)) linkgdf_line = GeoDataFrame(linkdf_line, geometry='geometry')
Unfortunately, I keep getting this error:
ValueError: Input [<shapely.geometry.point.Point object at 0x000002AB98131AC8>, <shapely.geometry.point.Point object at 0x000002AB98131198>] is the wrong shape for a LineString
What is really confusing me is that this seems to work in a jupyter notebook, but not running my python script in terminal.