I've created a blank spatially Enabled Dataframe with columns,
I'm attempting to append an a row to the Dataframe, which I'm doing successfully,
but as I append a row it overwrites the SHAPE column of all previous rows.
Solved! Go to Solution.
I would double check the code that constructs the geometry for each row to append.
The append function for SDF is actually from standard Pandas DataFrame, which is pretty robust and unlikely to have a bug for this basic function. Anyway, hard to say without seeing the code.
# currently reading in a shapefile to get headers (saves creating the Spatially enabled DataFrame from scratch)
# I remove all rows but keep a deep copy of one record called record_template
# make a record to set values on
# in code generating new_line using shapely linemerge (taking multiple line sections making one long route)
# for this example I took a sample see below
new_line = [[306572.786, 227598.16], [306581.202, 227591.756999999], [306585.583, 227587.403999999], [306589.315, 227583.198999999]]
# attempting to use deep copy to fix the issue (no change)
# I've also attempted to put the record into a dict but with the same result
# When I view the records the Name value will change per record as expected, but the SHAPE value of all
# records is always equal to the most recent record appended
I am crafting an example to replicate your issue, but I am getting hung up on:
Trying to manipulate the geometry of the SHAPE column that way always generates a KeyError.
My mistake. It wasn't the issue you describe, in terms of being a line geometry, I simply created/extracted the working record incorrectly and was working with a data frame still instead of a series. Once I got the record to the correct data type, the error accessing paths went away.