Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am very new to GIS and learning by myself so what I'm about to ask is possibly quite basic. 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?

many thanks.

share|improve this question
    
Alex, to start, you should get your custom-format wkt file into a shapefile so you can do a spatial analysis against two files of the same format. QGIS can handle your analysis, but those files have to be in the same format before you can get traction. –  elrobis Dec 3 '12 at 15:20
    
Hi, thanks for your answer. I will now try to find out how to make that spatial analysis. –  Alex Caseiro Dec 3 '12 at 16:08
add comment

2 Answers 2

Thanks for your answer.

I managed through 2). Since the land cover shapefile already had an area field, that was easy, just had to do it for my polygons shapefile.

So, at the end of 2), I had 2 shapefiles: - one with land cover data, with many fields, among which Object_ID, Code_Area and Shape_area - one with my twelve polygons I had made from a wkt, with two fields: sector_ID and sector_area

when I run the intersection, I get a new layer (shapefile), something like

Object_ID Code_Area Shape_Area sector_ID sector_area

I did not run through 4) because it is not really what I want. Actually, I want to know how each sector_ID's area is made up (that much of Code_Area_1, that much of Code_Area_2, ...)

could you please help me on that?

many thanks for your efforts

Alex

share|improve this answer
add comment

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.

share|improve this answer
    
Personally, I would never trust an Area field I did not create myself---if the dataset came with that Area field, while it's probably fine, the truth is it is a baked-in value that someone else created, and maybe or maybe not they did it correctly, but maybe they did it for different map units? Also, maybe the data has changed since that Area value was calculated, and now it is misleading? My point is, it's better practice to know for sure your values are prim-and-proper by setting them yourself. If you were on my staff, I wouldn't want you assuming those values were just A-okay. –  elrobis Dec 3 '12 at 18:40
    
Thanks for the tip. I cross-checked the values of the Area field originally present in the land cover product and they were the same as those from the new field I created myself. –  Alex Caseiro Dec 4 '12 at 9:41
    
Hi I managed to get what I was looking for: I used the clip function. First, I selected a feature (a polygon) from the polygons shapefile. Then, I use the clip function, with the land cover shapefile as input layer and the polygon shapefile as the clip layer, using only the selected features. A new shapefile is created, and I can calculate the area of each portion (classified by the land cover ID) within the new shapefile. Is it possible to do it more efficiently? Thanks –  Alex Caseiro Dec 4 '12 at 10:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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