I am trying to get a point that exists along a line at X distance. I have a geodataframe that is a line feature as line_gdf and from this source Returns a point interpolated along a line using geopandas I determined that I can return a point using
line_gdf.interpolate(x) #where x is the distance along the line
print(line_gdf.interpolate(x)
prints to the terminal
FEATURE_ID
2590.0 POINT (3436860.037 1626965.958)
dtype: geometry
I'm trying to pass this geometry to a new dataframe being created with stat field
stat_pts = pd.DataFrame(
{'NAME': [point_set['NAME'].loc[cindex], point_set['NAME'].loc[cindex + 1]],
'ID': [point_set['FEATURE_ID'].loc[cindex], point_set['FEATURE_ID'].loc[cindex + 1]],
'TRANS': [point_set['TRANS'].loc[cindex], point_set['TRANS'].loc[cindex + 1]],
'POSITION_UTC_DATE': [sdate, edate],
'SPEED': [(point_set['SPEED'].loc[cindex] + point_set['SPEED'].loc[cindex + 1]) / 2, (point_set['SPEED'].loc[cindex] + point_set['SPEED'].loc[cindex + 1]) / 2],
'geometry': [(line_gdf.interpolate(x)), line_gdf.interpolate(x)]})
When I try to make this into a geodataframe with geometry='geometry' I get the feature collection error. I found that when I export the pandas dataframe to csv that my geometry column is not populated properly with FEATURE_ID filling the field; not the ID number but 'FEATURE_ID' adding .geometry didn't change anything.
How do I gather the geometry info from this object and pass it to the geometry column of the new dataframe?