How can I access the coords.coords
property of a LineString in GeoDataFrames?
I can access other properties, such as area, length, etc, as documented in the ShapelyShapely's documentation. See reproducible example below:
# create example GeoDataFrame with LineString`
line_new = LineString([(0.3, 0.6), (1.5, 1.6), (0.9,2.5)])
df = gpd.GeoDataFrame()
df.loc[0, 'geometry'] = line_new
# create example GeoDataFrame with LineString`
line_new = LineString([(0.3, 0.6), (1.5, 1.6), (0.9,2.5)])
df = gpd.GeoDataFrame()
df.loc[0, 'geometry'] = line_new
This works:df.geometry.length
0 2.643715
dtype: float64
But this does not: df.geometry.coords
. It returns the following error:
return object.__getattribute__(self, name)
AttributeError: 'GeoSeries' object has no attribute 'coords
return object.__getattribute__(self, name) AttributeError: 'GeoSeries' object has no attribute 'coords'
My understanding from the geopandas documentationGeoPandas Documentation was that the 'geometry'
GeoSeries in a GeoDataFrame was a Shapely object, and thus the respective properties/methods would be available:
The GeoSeries class implements nearly all of the attributes and methods of Shapely objects.
Is the coords
attribute simply one of the few that are not implemented?
Is this the same as what is being asked in hereExtracting points from LineString or Polygon and making dictionary out of them in GeoPandas?