Read shapefile as a numpy array

المشرف العام

Administrator
طاقم الإدارة
Is it possible to read a shapefile with ogr as a numpy array, in order to use it as a mask to filter out a geotiff image?

What I would like to obtain is a numpy array from the layer below:

from osgeo import ogrmap = ogr.Open('file.shp')layer = map.GetLayer()When I rasterize the shapefile using gdal_rasterize (into tif), I cannot find the correct resolution for the obtained raster that matches the resolution of my geotiff file.

Note: The shapefile I'm trying to read contains around 6K features with 5 fields, among them is the area_ha.



أكثر...
 
أعلى