I have a thematic (discrete, integer) raster and want to use the minority and majority statistics. However the output is always nan. If I run the same commands with mean, min, max, I get sensible numerical output (except that only a majority output would be sensible in my use case).
exactextract \
-r luc:./nzfarm.raster.tif \
-p ./parcels.gpkg[parcels] \
-f id \
-s majority(luc) \
-o ./parcels.majority.nzfarm.raster.csv
head ./parcels.majority.nzfarm.raster.csv
There is no nan data where the input vector information overlaps the raster (though the raster does have nan data in other places). In the full set, most of my vector features are smaller than the raster cell size, but very many are much larger. The output is consistent regardless of vector feature size.
I don't know whether this is relevant, but both my raster and vector are both projected in EPSG:3851, which happens to cross the antimeridian.
(Also, in the readme I think you've reversed majority/minority with respect to the sample use case. i.e. a "majority" should give you the most common land cover type, but your table says "least common".)
Here's a screenshot of the sample area. The vector features are polygons, I have just not drawn them with a fill. They may overlap.
I have a thematic (discrete, integer) raster and want to use the
minority
andmajority
statistics. However the output is alwaysnan
. If I run the same commands withmean
,min
,max
, I get sensible numerical output (except that only amajority
output would be sensible in my use case).Same command's output but for
max
instead ofmajority
:min
...and for
mean
(nonsense output for my use-case, but demonstrating that it works):variety
doesn't seem to work either, but reports 0 rather than NaN:count
:There is no nan data where the input vector information overlaps the raster (though the raster does have nan data in other places). In the full set, most of my vector features are smaller than the raster cell size, but very many are much larger. The output is consistent regardless of vector feature size.
I don't know whether this is relevant, but both my raster and vector are both projected in EPSG:3851, which happens to cross the antimeridian.
I note that I can't see a test for
majority
statistics in https://github.com/isciences/exactextract/blob/master/test/test_stats.cpp onlymode
andminority
. I supposemode
is an alias formajority
?(Also, in the readme I think you've reversed majority/minority with respect to the sample use case. i.e. a "majority" should give you the most common land cover type, but your table says "least common".)
Here's a screenshot of the sample area. The vector features are polygons, I have just not drawn them with a fill. They may overlap.