# OTB 7 RC1 - ZonalStatistics

**URL:** <https://forum.orfeo-toolbox.org/t/otb-7-rc1-zonalstatistics/435>\
**Category:** OTB Usage\
**Created:** [October 3, 2019, 11:56am UTC](https://forum.orfeo-toolbox.org/t/otb-7-rc1-zonalstatistics/435 "2019-10-03T11:56:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PedroVenancio](https://forum.orfeo-toolbox.org/user_avatar/forum.orfeo-toolbox.org/pedrovenancio/32/157_2.png) [@PedroVenancio](https://forum.orfeo-toolbox.org/u/PedroVenancio)\
**Post date:** [October 3, 2019, 11:56am UTC](https://forum.orfeo-toolbox.org/t/otb-7-rc1-zonalstatistics/435/1 "2019-10-03T11:56:13Z")

</div>

I’m trying to use ZonalStatistics application from Monteverdi Application Launcher, and, using output as vector, I get a crash without further info:

 ![zonal_stats_mapla](https://forum.orfeo-toolbox.org/uploads/default/original/1X/5bc4b77086f11d5b8d501e0558ad499d287884e0.jpeg)

Using raster as output, I get this message in log

```
2019-10-03 12:37:05 (INFO) ZonalStatistics: Default RAM limit for OTB is 256 MB
2019-10-03 12:37:05 (INFO) ZonalStatistics: GDAL maximum cache size is 813 MB
2019-10-03 12:37:05 (INFO) ZonalStatistics: OTB will use at most 8 threads
2019-10-03 12:37:05 (INFO) ZonalStatistics: Zone definition: vector
2019-10-03 12:37:05 (INFO) ZonalStatistics: Loading vector data...
2019-10-03 12:37:10 (INFO) ZonalStatistics: Removing entries for label value 2147483647
2019-10-03 12:37:10 (INFO) ZonalStatistics: Writing output raster data
2019-10-03 12:37:10 (INFO) ZonalStatistics: Output raster image will have 13 bands
2019-10-03 12:37:10 (FATAL) ZonalStatistics: itk::ERROR: VectorDataFileWriter(00000263D62C7030): No input to writer!

```

Using ZonalStatistics in CLI, everything runs ok, both with vector or raster as output:

```
C:\OSGeo4W64\OTB-7.0.0-rc1-Win64\OTB-7.0.0-Win64>otbcli_ZonalStatistics -in D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\L2A_T29TPF_A019196_20190224T112923_2019-02-24\Composicao_12_8_3.tif -inzone.vector.in D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29.shp -out.vector.filename D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.shp
2019-10-03 12:11:59 (INFO) ZonalStatistics: Default RAM limit for OTB is 256 MB
2019-10-03 12:11:59 (INFO) ZonalStatistics: GDAL maximum cache size is 813 MB
2019-10-03 12:11:59 (INFO) ZonalStatistics: OTB will use at most 8 threads
2019-10-03 12:11:59 (INFO) ZonalStatistics: Zone definition: vector
2019-10-03 12:11:59 (INFO) ZonalStatistics: Loading vector data...
2019-10-03 12:11:59 (INFO): Estimated memory for full processing: 4598.9MB (avail.: 256 MB), optimal image partitioning: 18 blocks
2019-10-03 12:11:59 (INFO): Estimation will be performed in 19 blocks of 10980x578 pixels
 (0s)
Computing statistics: 100% [**************************************************] (5s)
2019-10-03 12:12:04 (INFO) ZonalStatistics: Removing entries for label value 2147483647
2019-10-03 12:12:04 (INFO) ZonalStatistics: Writing output vector data
 (0s)

```

- 

```
C:\OSGeo4W64\OTB-7.0.0-rc1-Win64\OTB-7.0.0-Win64>otbcli_ZonalStatistics -in D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Composicao_12_8_3.tif -inzone.vector.in D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29.shp -out raster -out.raster.filename D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif float
2019-10-03 12:40:10 (INFO) ZonalStatistics: Default RAM limit for OTB is 256 MB
2019-10-03 12:40:10 (INFO) ZonalStatistics: GDAL maximum cache size is 813 MB
2019-10-03 12:40:10 (INFO) ZonalStatistics: OTB will use at most 8 threads
2019-10-03 12:40:10 (INFO) ZonalStatistics: Zone definition: vector
2019-10-03 12:40:10 (INFO) ZonalStatistics: Loading vector data...
2019-10-03 12:40:10 (INFO): Estimated memory for full processing: 4598.9MB (avail.: 256 MB), optimal image partitioning: 18 blocks
2019-10-03 12:40:10 (INFO): Estimation will be performed in 19 blocks of 10980x578 pixels
 (0s)
Computing statistics: 100% [**************************************************] (5s)
2019-10-03 12:40:16 (INFO) ZonalStatistics: Removing entries for label value 2147483647
2019-10-03 12:40:16 (INFO) ZonalStatistics: Writing output raster data
2019-10-03 12:40:16 (INFO) ZonalStatistics: Output raster image will have 13 bands

2019-10-03 12:40:16 (INFO): Estimated memory for full processing: 12416.8MB (avail.: 256 MB), optimal image partitioning: 49 blocks
2019-10-03 12:40:16 (INFO): File D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif will be written in 64 blocks of 1568x1568 pixels
Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 0% [Encode output raster image: 100% [ **************************************************] (0s)
Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 2% [* Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 4% [**Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 6% [*** Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 8% [****Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 10% [***** Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 12% [******Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 14% [******* Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 16% [********Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 18% [********* Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 20% [**********Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 22% [*********** Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 24% [************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 26% [************* Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 28% [**************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 30% [*************** Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 32% [****************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 34% [***************** Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 36% [******************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 38% [******************* Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 40% [********************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 42% [********************* Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 44% [**********************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 46% [*********************** Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 48% [************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 50% [************************* Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 52% [**************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 54% [*************************** Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 56% [****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 58% [*****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 60% [*****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 62% [*****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 64% [*****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 66% [*****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 68% [*****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 70% [*****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 72% [*****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 74% [*****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 76% [*****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 78% [*****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 80% [*****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 82% [*****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 84% [*****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 86% [*****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 89% [*****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 90% [*****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 92% [*****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 95% [*****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 96% [*****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 98% [*****************************Writing D:\SIG\DETECCAO_REMOTA\SENTINEL_2\2019_02_24\Pinhel_WGS84_UTM29_stats.tif...: 100% [**************************************************] (2m 02s)

```

I’m with OTB-7.0.0-rc1-Win64 on Windows 10.

Anyone confirm?

Thanks!

Best regards,  
Pedro Venâncio

---

<div class="post-metadata">

**Author:** ![Antoine](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/a/7ab992/32.png) [@Antoine](https://forum.orfeo-toolbox.org/u/Antoine)\
**Post date:** [October 3, 2019, 3:48pm UTC](https://forum.orfeo-toolbox.org/t/otb-7-rc1-zonalstatistics/435/2 "2019-10-03T15:48:59Z")

</div>

Hi Pedro,  
Can you confirm the bug from the GUI application (not through Monteverdi)?

Antoine

---

<div class="post-metadata">

**Author:** ![Cedric](https://forum.orfeo-toolbox.org/letter_avatar_proxy/v4/letter/c/ecd19e/32.png) [@Cedric](https://forum.orfeo-toolbox.org/u/Cedric)\
**Post date:** [October 3, 2019, 4:02pm UTC](https://forum.orfeo-toolbox.org/t/otb-7-rc1-zonalstatistics/435/3 "2019-10-03T16:02:38Z")

</div>

I can reproduce the bugs (ubuntu 16.04) on Monteverdi, but not on gui.

I need to investigate regarding the crash in the first case (vector output)

Regarding the second case (raster output), the issue comes from the output vector data parameter having a default value, even when the choice out.vector is not active. Because the parameter has a value, the application tries to create an output vector data file with no input.

One workaround is to manually remove the default value in Monteverdi. But this a bug, the application should not write the vector data if the parameter is not active.

Thanks for the report @PedroVenancio

Cédric

---

<div class="post-metadata">

**Author:** ![PedroVenancio](https://forum.orfeo-toolbox.org/user_avatar/forum.orfeo-toolbox.org/pedrovenancio/32/157_2.png) [@PedroVenancio](https://forum.orfeo-toolbox.org/u/PedroVenancio)\
**Post date:** [October 3, 2019, 4:23pm UTC](https://forum.orfeo-toolbox.org/t/otb-7-rc1-zonalstatistics/435/4 "2019-10-03T16:23:12Z")

</div>

Hi @Antoine and @Cedric

I confirm that GUI app works well also in Windows.

So, both problems only affect Monteverdi.

Thank very much!

Best regards,  
Pedro
