I've been developing code to take a .csv with lat-long coords and convert them to LineStrings before creating parallel offsets for them. This has been working so far, but yesterday after clearing my variables, I started running into an error when running my code.
from shapely.geometry import LineString, Point
import pandas as pd
import geopandas as gpd
df = pd.read_csv("***/Kingsboro Rd NE.csv")
df = df.drop_duplicates()
geometry = [Point(xy) for xy in zip(df.lng, df.lat)]
df['geometry'] = geometry
df['agg'] = 1
df_line = gpd.GeoDataFrame(df.groupby(['agg'])['geometry'].apply(lambda x: LineString(x.tolist())), geometry='geometry')
df_line = df_line.set_crs("EPSG:4326")
df_line = df_line.to_crs("EPSG:2240")
df_offset_l = pd.DataFrame(df_line.iloc[0].geometry.parallel_offset(25, 'left', 2, mitre_limit = 100.0))
Everything runs fine until the final line, for which I get the following error:
ValueError: DataFrame constructor not properly called!
As I mentioned before, I have not been getting this error until yesterday, and I need it to work properly to perform the other data manipulation steps following this line of code.
Here's a sample of the input file:
lat | long |
---|---|
33.85556214 | -84.35139656 |
33.85569133 | -84.35140193 |
33.85556214 | -84.35139656 |
33.85553986 | -84.35136706 |
33.85550868 | -84.35134828 |
DataFrame
orGeoDataFrame
? – Kadir Şahbaz Jan 5 at 17:19