Im learning to use shapely and have two shapefiles--forest, and basins. The two shapefiles clearly intersect (basins is completely within forest). But the way I've gone about it only gets the feature at index 0 of each shapefile, which don't intersect. I know where this is taking place in the script, but how do I get the whole polygon shape as wkt instead of just one record? Do I build a list of the wkt geometry one record at a time?
# Basins shapefile to wkt basins = ogr.Open("data/Basins.shp") basins_layer = basins.GetLayer(0) basins_feature = basins_layer.GetFeature(0) # This is the line # I'm thinking there should probably be a loop here to get the geometry of the whole shapefile basins_geometry = basins_feature.GetGeometryRef() basins_wkt = shapely.wkt.loads(basins_geometry.ExportToWkt())
How do I loop through the whole shapefile and build the outer polygon as wkt or is there another function to get the outer boundary of the shapefile? I guess this is called the outer ring. I want wkt of the whole shapefile exterior, rather than the individual polygons that make it up.