I have the below GeoPandas dataframe that has:

  1. two columns: geometry and raster_val
  2. 13 rows

The first row is shown below.

    geometry                                                  raster_val
0   POLYGON ((746124.59744 3382358.69579, 746124.5...         5.0

I want to use the Geopandas geometry to get the raster pixels inside each polygon and store the pixel values in separate numpy arrays.

  • raster_val is a numerical value that represents the class of each polygon. There are 6 different class types. I want to use the geometry to clip a raster file. – Lisa Mathew May 4 '18 at 6:26
  • I think the first half of the answer to gis.stackexchange.com/questions/260304/… is pretty close to what you want. – BERA May 4 '18 at 6:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.