I am loading a shapefile to GeoDataFrame using GeoPandas method read_file
. I need to apply some replacement modifications on a column with geometry data. To do this I am casting this column as string. Without casting executing .replace
is causing an error TypeError: expected string or bytes-like object
. However, this operation leads to trimming of original data in the geometry column. Below is an example for differences in one cell:
Column GEOMETRY from Shapefile loaded to GeoDataFrame:
LINESTRING (13.90327032848085764 46.61940531353186401, 13.90327032848085587 46.61940531353186401)
Column GEOMETRY from GeoDataFrame converted to string:
LINESTRING (13.90327032848086 46.61940531353186, 13.90327032848086 46.61940531353186)
And my code to convert geometry type to string type is:
geodataframe['geometry'] = geodataframe.geometry.astype(str)
In geometry column I can have lines and multilines with a variable number of XY pairs. Above was just a simple example. Does anybody know how to convert it without unwanted rounding?