Walshe_d
Walshe_d

Reputation: 171

How to get proportions of polygons by class

I've 2 issues when classifying my image to get the proportion

1: i've classified my image into three classes (1,2,3) and i'm trying to use pkextractogr from pktools to get the proportions of each class using a vector polygon. The code below will run but will only output proportion for class 3. It will output a new file and in the attribute table there will be a column for class 1 and class 2 but they will be blank. If i try use it for just one class the output will either be 100% or 0% for the specified class. I've tried doing this on the command line and also in qgis (using pktools as a plugin).

2: When i use qgis the ogr tells me that the data source is invalid but i can't figure out why as both files are in the same projection.

data source invalid enter image description here

pkextractogr -i classified_image.tif -s polygon.shp -o classified_proportion.shp -polygon -r proportion -c 1 -c 2 -c 3

Does anyone have a solution to either problem? im using fedora 26 and qgis 2.18.14

Upvotes: 1

Views: 105

Answers (1)

Walshe_d
Walshe_d

Reputation: 171

The version of pktools i was using 2.8.7 had a bug, i downloaded 2.8.7.3 which has resolved the problem

Upvotes: 0

Related Questions