5

How and with what QGIS tools can I get a confusion matrix from a vector polygon layer as a verifiable classification and a vector point sample layer as a reference classification?

enter image description here

That is, if the point with the class of "Rubber" hits the polygon c is a class "Rubber", the classification for this point is correct, if the point does not fall in any polygon, that point is not needed, if the classification of points and the polygon in which it are not the same, the classification for this point is wrong.

These are the vectors.

1 Answer 1

0

I'd use Vector->Data Management Tools->Join Attributes by Location. Choose your point layer as the 'input layer' and the polygon layer as the 'join layer' and choose 'Within' for the 'Geometric predicate'. This will give you a new temporary layer with the attributes of your polygons joined to the attribute of the points within them. You can then use Layer->Filter to select the points class = the attribute of the polygons class using the expression "Class" = "class_2" in the 'Provider specific filter expression' box. Once the filter has been applied you can save the filtered points out to a new layer

If you'd rather classify your points instead you can open up the attribute table of your temporary layer and use field calculator to create a new field with your classification in - the following expression will place a 1 in the new field where the classes match and a 0 where they don't: if( "Class" = "class_2",1,0)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.