0
 SHAPE_PATH = os.path.join(".", "/home/sahil/", "mapa.geojson")

  area_gdf = gpd.read_file(SHAPE_PATH)

Geometry of an entire area

   full_geometry = Geometry(area_gdf.geometry.values[0], crs=CRS.WGS84)

Bounding box of a test sub-area

   test_bbox = Geometry(area_gdf.geometry.values[1], crs=CRS.WGS84).bbox

   area_gdf.plot(column="name");

Error- index 1 is out of bounds for axis 0 with size 1

  • 1
    what does `len(area_gdf)` return, it 1 then of course its out of bounds... how many features in the geojson - probably only 1... – Rob Raymond Sep 14 '22 at 14:30
  • Does this answer your question? [Does "IndexError: list index out of range" when trying to access the N'th item mean that my list has less than N items?](https://stackoverflow.com/questions/1098643/does-indexerror-list-index-out-of-range-when-trying-to-access-the-nth-item-m) – Michael Delgado Sep 14 '22 at 18:07
  • yes len(area_gdf) returns 1. Im not sure why this is not working – Sahil Jain Sep 15 '22 at 11:55
  • if length is 1, then absolutely it's out of bounds error as lists / arrays are zero indexed. `area_gdf.geometry.values[1]` is the 2nd value in array that has only 1 value – Rob Raymond Sep 16 '22 at 15:53
  • the question needs sufficient code for a minimal reproducible example: https://stackoverflow.com/help/minimal-reproducible-example – D.L Sep 19 '22 at 08:45

0 Answers0