Skip to main content
3 of 4
deleted 6 characters in body
gene
  • 55.4k
  • 3
  • 113
  • 191

A GeoSerie is a list of shapely geometries, therefore

  1. with shapely

    from shapely.geometry import LineString, shape line_new = LineString([(0.3, 0.6), (1.5, 1.6), (0.9,2.5)]) type(shape(line_new)) <class 'shapely.geometry.linestring.LineString'> list(shape(line_new).coords) [(0.3, 0.6), (1.5, 1.6), (0.9, 2.5)]

  2. with your GeoDataFrame (list of shapely geometries)

    type(df.geometry) <class 'geopandas.geoseries.GeoSeries'> df['geometry'].coords .... AttributeError: 'GeoSeries' object has no attribute 'coords'

First row of the GeoSerie = first shapely geometry

 type(df.geometry.iloc[0])
 <class 'shapely.geometry.linestring.LineString'>
 list(df.geometry.iloc[0].coords)
 [(0.3, 0.6), (1.5, 1.6), (0.9, 2.5)]
gene
  • 55.4k
  • 3
  • 113
  • 191