# [Thuban-list] Classifications

Bernhard Herzog bh at intevation.de
Thu Jan 8 15:40:30 CET 2004

"Daniel Calvelo Aros" <dcalvelo at minag.gob.pe> writes:

> 2) O error: some average on the *overall* visualization error. This is
> calculated by something like
>
> $$\sum_{i=1}^L |v_i - m_i|*A_i$$ where v and m are the same as the previous
> ones, and A_i is the area of the i-th polygon. This is an average or total
> error *volume*, which takes into account the fact that larger polygons are
> visually prominent over smaller ones.
>
> That means that in order to calculate an O-type index error, we need
> to access the area of the polygons corresponding to the data.
>
> Hints on doing this elegantly?

Well, computing the area of a polygon isn't difficult.

IIUC the area is the area of the polygon as drawn on the map since we're
dealing with visualization error.  So what you have to do is to iterate
through all shapes, apply projections if projections are defined for the
map and/or layer and compute the area of the resulting polygon.

Determining the area of polygons is something that Thuban needs to be
able to do anyway, I think.

> The ideal would be to have a classifier class to which an array of
> areas is passed, instead of accessing the shape info from the
> classifier.

I'm not sure what you mean by this exactly.  The interface for the
functions in e.g. Thuban/Model/classgen.py is not fixed, so a function
that takes attribute data and area for each shape wouldn't be a problem.

What needs to be done, though, is to make the gui more flexible.  Which
kinds of classification factories exist and which parameters they need
is hard wired in Thuban/UI/classgen.py.  That needs to be refactored so
that new kinds of classifications factories can be defined in extensions

> 3) B error: this is the tricky one. The boundary error measures the average of
> differences in v vs. m values between *neighboring* polygons. In order to
> implement this, we would need some representation of the layer's topology,
> ideally an adjacency matrix for all the polygons.
>
> How can you get an adjacency matrix from a polygon layer?

There's no such functionality in Thuban currently and I don't know how
difficult it would be to implement.  I'd have to do some research first
to look at what algorithms exist for this and which free software

> Any hints are welcome!

Just keep posting the questions you have.  The classifications you
describe sound very interesting and it would definitely be good to have
them in Thuban.

Bernhard

--
Intevation GmbH                                 http://intevation.de/
Sketch                                 http://sketch.sourceforge.net/
Thuban                                  http://thuban.intevation.org/