0

I am very new to GIS and learning by myself.

I am using QGIS.

I have a shapefile, which categorizes areas (land cover) by numbers (corresponding to land cover classes).

I have created a wkt file with twelve polygons, with the following structure: id|polygon

e.g.:

150-180|POLYGON((559053 4367372,559053 4364372,557553 4366970.07621135,559053 4367372))

120-150|POLYGON((557553 4366970.07621135,559053 4364372,556454.923788647 4365872,557553 4366970.07621135))

90-120|POLYGON((556454.923788647 4365872,559053 4364372,556053 4364372,556454.923788647 4365872))
....

The polygons from the wkt file superimpose categorized areas from the shapefile.

I wish to know the following: how much of each category (from the shapefile) is included in each polygon from the wkt file?

e.g.:

150-180: 0.25 of the area is category 232 + 0.70 of the area is category 123 + 0.05 of the area is category 657

How can I do this?

0

1 Answer 1

2

I believe your QGIS workflow should be this:

1) Get both your datasets into shapefile format and make sure they have the same projection (I recommend using a UTM or an equal-area projection, but not a geodetic coordinate system, where positions correspond to lat/long).

2) In QGIS, make an area value column for both datasets. To do this, open the shapefile's attribute table, select Toggle Editing, then use the Field Calculator to create a new field to hold the area values; for example land_area, and type_area. Set the field type to decimal, and set width/precision to large values like 20/4, respectively. This might be inefficient, but it's safe. Finally, expand the Geometry node, then double-click on $area and select OK. Disable Toggle Editing.

3) With Area fields created for both the land area polygons and the classes polyons, execute a geometric intersection (Vector menu > Geoprocessing Tools submenu > Intersect). Select the Land Area file as the input, and select the Land class file as the intersect, provide an output name and select OK. Make sure to wait for the result (QGIS will ask if you want it added to the map). Resist the temptation to click OK again, or even cancel, just wait for it, then when it's done add the new layer. At that point it's safe to click cancel.

4) Finally, open the attribute table for the intersection result, enable Toggle Editing on the layer, and open the Field Calculator. This time, create a new field, area_pct, use the same setup for type/width/precision (decimal, 20, 4), and expand the Fields and Values node.. when you double-click on a field name, you'll add it to the expression you want QGIS to evaluate for each of your intersection geometries. If you used field names like I suggested above, you'll want to build an expression like this one:

("type_area"  /  "land_area" ) * 100

Then just execute it and you'll have the results you're after.

If you're unfamiliar with GIS basics, my concern is the first step may present the biggest challenges. But if you are a programmer, I'm sure you will be a quick study.

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.