I don't see anything in OTB that does exactly what you need.
The approach you propose seems the right one. I see two other ways :
On 08/03/2018 05:34 PM, Jordi Inglada wrote:
Hi, Given an image (raster) and a vector file containing polygons, I need to compute a series of values for each polygon like the mean of a particular band of the raster, etc. and then produce a new (or update the) vector file with new fields. I think these are called zonal statistics.It looks like the LSMSVectorization application does that, but it uses a raster segmentation instead of an input vector file. Given that my polygons cover only a small fraction of the input raster, I don't think than rasterizing the vector file to use this application will be efficient. An besides, I would have to link back the attributes to the original polygons, which is an additional step. Is there any other way to do that with existing OTB applications? Maybe gdal command line tools can do that? I have been looking around and it seems that this is usually done the way LSMSVectorization does it (burn the vector to raster, then compute using rasters only). Do you have any advice on how to proceed if I need to write my own application for that? I guess I will have to if I want to be able to compute other features than mean and variance of the raster bands. By the way, my images and vector data are huge, so streaming and multi-threading will be needed. I was thinking about the following approach: 1. Read in a set of polygons until a total surface is reached (so that we can associate that with the RAM needed for the total number of raster pixels to keep in memory). 2. Project the polygons onto the raster geometry and read in the pixels 3. Parallel computation of the stats (either with an OpenMP loop or a simple thread pool ) 4. Write the geometries and the stats to the output file 5. Release the memory and go back to 1 Any comments on that? Thanks. Jordi  https://jordiinglada.net/wp/2015/05/13/a-simple-thread-pool-to-run-parallel-prosail-simulations/
Check the OTB FAQ at
You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to email@example.com
To unsubscribe from this group, send email to
For more options, visit this group at
You received this message because you are subscribed to the Google Groups "otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otb-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
- [otb-users] Zonal stats: updating polygons of a vector fi... Jordi Inglada
- Re: [otb-users] Zonal stats: updating polygons of a ... Guillaume Pasero
- [otb-users] Re: Zonal stats: updating polygons of a ... Daniel McInerney