The code that extract statistics consists on these steps:
Create a new shapefile with only the selected entity with its attributes
Add the .prj file copying it from the original
Open the new shapefile with IDLffShape and GetAttribute
Extact the records
Open the new shapefile with OpenVector
Create a new Roi with EnviRoi
Add the record using AddVectorRecords, myvector, record
Save the roi as xml file
Open the new roi xml file
Use the EnviRoiMaskRaster(my_raster, roi_xml) command
Use ENVIRasterStatistics (masked_raster) to obtain the mean as Stats.Mean
Now i tryed to execute the command: IF (Stats.Mean LT 7000) THEN myshape->DestroyEntity, ent
Then i tryed to do another thing: create a roi.xml from the original shapefile i want modified to delete the corresponding VectorRecords using the code: IF (Stats.Mean LT 7000) THEN rois_xml.ClearVectorRecords, myvector
where rois_xml is a roi.xml file corresponding to the first shapefile opened before the FOR cicle and named myshape (see previous post). This code does not exit with an error but does nothing and does not modify the rois_xml file.
If you want to see the full code ask me.
But my need is simple: i want cicle inside a vector of polygons, compute the mean over a raster for each polygon, apply a condition (mean less then 7000), delete the corresponding entity from the shapefile, save the new shapefile.
Using vector utilities or roi utilities or both it's the same thing for me.
|