I am working on mangroves in Sundarbans (Bangladesh / India), using Landsat pictures. I need to equalize them in reflectance, before classification, for the evolution of the biomass in this region. I have a mangroves' shapefile over this area, with +150 000 features (polygons). So far, the segmentation part and the classification part work well. However, to be able to equalize the pictures, I need to focus on the overlapping parts between this pictures. I succeeded in extracting the overlap between two pictures, and then having the shapefile corresponding to the boundaries of the overlap.
First, what I need to do is clipping the big mangroves' shapefile to the extent of an overlap between 2 images, so I can then compute the overlapping raster with only the mangroves parts to equalize these two pictures. I tried this following command :
ogr2ogr -f ESRI Shapefile -clipsrc extent.shp mangrove_clip.shp mangrove.shp
I am coding in python, but even on a direct command line request, this doesn't seem to work. Actually, I don't have any message to screen here because nothing is screened on the terminal, as if the command ran indefinitely... I know that on QGIS, there is the clip tool under "Vector > Geoprocessing Tools". This works perfectly, and it is really fast (less than 30s). The thing is that I need to script this because I have over 10 images on this area and I need to work on every overlap between every images, so doing it manually through QGIS is not feasible. Besides, I may have to re-use that for other parts of the world.
That's a pity that for the vector part, QGIS does not screen the corresponding command line like it does for the raster (filling the gdalwarp with its arguments for example, when you want to clip a raster). Does anybody know what's wrong with my ogr2ogr command ? i know that's a hard question considering I have no returned error message... What's the command QGIS is using ? I tried hard to find an answer but every topic ended with this ogr2ogr command as a solution.
And the command actually works for another shapefile...
Even if by letting the command run for 2 days, it worked, I don't think it's normal for it to take so long when QGIS does it in 30s.
Concerning the mangroves' shapefile (which looks to be the problem, but once again, it works with QGIS), it is a polygon shapefile, and my extent shapefile is also a polygon shapefile.
أكثر...
First, what I need to do is clipping the big mangroves' shapefile to the extent of an overlap between 2 images, so I can then compute the overlapping raster with only the mangroves parts to equalize these two pictures. I tried this following command :
ogr2ogr -f ESRI Shapefile -clipsrc extent.shp mangrove_clip.shp mangrove.shp
I am coding in python, but even on a direct command line request, this doesn't seem to work. Actually, I don't have any message to screen here because nothing is screened on the terminal, as if the command ran indefinitely... I know that on QGIS, there is the clip tool under "Vector > Geoprocessing Tools". This works perfectly, and it is really fast (less than 30s). The thing is that I need to script this because I have over 10 images on this area and I need to work on every overlap between every images, so doing it manually through QGIS is not feasible. Besides, I may have to re-use that for other parts of the world.
That's a pity that for the vector part, QGIS does not screen the corresponding command line like it does for the raster (filling the gdalwarp with its arguments for example, when you want to clip a raster). Does anybody know what's wrong with my ogr2ogr command ? i know that's a hard question considering I have no returned error message... What's the command QGIS is using ? I tried hard to find an answer but every topic ended with this ogr2ogr command as a solution.
And the command actually works for another shapefile...
Even if by letting the command run for 2 days, it worked, I don't think it's normal for it to take so long when QGIS does it in 30s.
Concerning the mangroves' shapefile (which looks to be the problem, but once again, it works with QGIS), it is a polygon shapefile, and my extent shapefile is also a polygon shapefile.
أكثر...