Hexagon Geospatial
MENU

ERDAS IMAGINE

Discuss and share topics of interest using ERDAS IMAGINE the world’s leading geospatial data authoring system.
Showing results for 
Search instead for 
Do you mean 
Reply
Contributor
Posts: 74
Registered: ‎11-02-2015
Accepted Solution

Zonal Majority - get the three most appearing class values for each zone

Hi there,

 

I am working on a complex model. For further processing of my datasets I need to combine a class raster with zone vectors. The goal is to get three tables added to the vector that do contain the 3 most appearing class values for each zone.

 

The most appearing one is easy peasy: compute the zonal summary matrix and use this as input for zonal majority and add this table (after removing the background call row) as new attribute table to the feature dataset.

 

But how do I get the two next most appearing values? Any ideas?

 

Thanks

Fritz

Geography is what geographers do...
Regular Contributor
Posts: 215
Registered: ‎11-16-2015

Re: Zonal Majority - get the three most appearing class values for each zone

Hiya. This is probably a terrible hack and there will be more elegant ways to do this, but the attached model takes the first zonal majority and then subtracts that value from the original classification leaving you with an output with which you can run another zonal majority to get the second most prevelant class. Repeat until you're happy! Cheers, Johnnie

Contributor
Posts: 74
Registered: ‎11-02-2015

Re: Zonal Majority - get the three most appearing class values for each zone

Hi Johnnie,

 

first of all, thanks for digging into my problem and your suggestion. But your included model does more or less solve only the first step. It gets the zonal majortiy value for each zone. You find my solution for this attached in the zip.

But as I told you. This is the first step. Next step is: get the second often/frequent class for each zone. And than get the third frequent class for each zone. The class file has between 70 and 100 different values.

To sum it up: I need three attributes for each zone that tell me: the most frequent, the second frequent and the third frequent class.

 

So either I am able to get this out of the summary matrix or I need to do some masking iterations where I set the most frequent vaule in each zone to no data and then re-run the zonal majority calculation.

 

Cheers

Fritz

Geography is what geographers do...
Regular Contributor
Posts: 215
Registered: ‎11-16-2015

Re: Zonal Majority - get the three most appearing class values for each zone

No, my model does more. It then takes that zonal majority, eliminates that value from the original classification and provides you with a new classification which you can run through zonal majority again to get the second most prevelent class. I didn't include that bit in the model as I was sure you'd be able to tack it on the end. Cheers, Johnnie

Contributor
Posts: 74
Registered: ‎11-02-2015

Re: Zonal Majority - get the three most appearing class values for each zone

Hi guys,

 

I think I have found a working solution. So if anybody is ever facing the same problem here comes my solution:

I am using the output table of the zonal majortiy operator to do a lookup with the zone raster. This will set all zone pixels to the zonal majortiy value of each zone. Next step is to set all class pixels in each zone that do have the same pixel value as the zonal majority pixels to 0. If I now re-run the zonal majortiy computation with the option to ignore all input pixels with the value of 0 I will endup with a table containing the second frequent pixel within each zone. Now I redo the step described above to retrieve the third frequent value!

 

Find my solution in the zip attached to this post.

 

Cheers

Fritz

Geography is what geographers do...
Do you need immediate support?
If you encounter a critical issue and need immediate assistance please submit a Service Request through our Support Portal.