Skip to main content
added 89 characters in body
Source Link
Taras
  • 34k
  • 4
  • 73
  • 148

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)]

    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'

    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)]
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)]

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)]

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)]
deleted 6 characters in body
Source Link
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.iloc[0]['geometry']geometry.iloc[0])
 <class 'shapely.geometry.linestring.LineString'>
 list(df.iloc[0]['geometry']geometry.iloc[0].coords)
 [(0.3, 0.6), (1.5, 1.6), (0.9, 2.5)]

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.iloc[0]['geometry'])
 <class 'shapely.geometry.linestring.LineString'>
 list(df.iloc[0]['geometry'].coords)
 [(0.3, 0.6), (1.5, 1.6), (0.9, 2.5)]

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)]
added 103 characters in body
Source Link
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'>

    first row

    type(df.iloc[0]['geometry']) <class 'shapely.geometry.linestring.LineString'> list(df.iloc[0]['geometry']df['geometry'].coords) [(0.3, 0.6), (1.5, 1.6), (0.9, 2.5)] AttributeError: 'GeoSeries' object has no attribute 'coords'

First row of the GeoSerie = first shapely geometry

 type(df.iloc[0]['geometry'])
 <class 'shapely.geometry.linestring.LineString'>
 list(df.iloc[0]['geometry'].coords)
 [(0.3, 0.6), (1.5, 1.6), (0.9, 2.5)]

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

    type(df.geometry) <class 'geopandas.geoseries.GeoSeries'>

    first row

    type(df.iloc[0]['geometry']) <class 'shapely.geometry.linestring.LineString'> list(df.iloc[0]['geometry'].coords) [(0.3, 0.6), (1.5, 1.6), (0.9, 2.5)]

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.iloc[0]['geometry'])
 <class 'shapely.geometry.linestring.LineString'>
 list(df.iloc[0]['geometry'].coords)
 [(0.3, 0.6), (1.5, 1.6), (0.9, 2.5)]
Source Link
gene
  • 55.4k
  • 3
  • 113
  • 191
Loading