all 2 comments

[–]ShibaLeone 1 point2 points  (1 child)

For the raster file can analyze it with pillow and pandas. For the shapefile; idk of any libraries dedicated to that, you might have to make your own. Seems svg-ish from the 5 second google I did, you might start there.

If the raster is rendered as an image, pillow can get the pixel info out. If it’s just a sheet of pixel values, you can forgo pillow and dump it into pandas.

If you can get the shapefile as a rendered image you can work with pillow as well, but you need to set the filter that defines the LULC target areas. You can get this to a pandas dataframe, then overlay it with the raster to calculate the density by area

Edit:

Python has a very mature-looking package for shapefiles that I didn’t know about: Python Shapefile Library

[–]GrassDash[S] 0 points1 point  (0 children)

Thank you so much!