Skip to main content
Hi, 

 

 

I am calculating land use %ages in a grid. I have a 1km grid overlaying a landcover polygon map and am simply calculating the &age of each 1km grid square that belongs to a particular land cover type. So far so good. 

 

 

I have around 16 land cover types and each 1km grid square may have 1, 2 or even up to 12 land cover types in it. Thing is, I want the calculated area for a land cover type in a grid square to automatically populate the correct attribute column, i.e. go to the correct column based on matching name.

 

 

I tried a list but as different land cover types exist in different grid squares, the position in the list does not always define the same land cover type. Any help?

 

 

thanks
just to clarify: For every grid square feautre I want all 16 land cover types as attributes. Some of them will be 0 as they dont exist in the grid square but the ones that do exist need to populate the correct attribute.
Hi,

 

 

 

You can use an areaonarea overlayer on the grid and the landcover. Enter a name for the list.

 

The list wil contain all the related objects.

 

Calculate the areasize (ie. areacalculator)

 

 

You can then use a statiscicscalculator for instance, grouped by Grid_id and cover_type. Attribute to calculate would then be areasize.

 

 

Use the grid id to remerge it to the grid object. (if that is what u want)

 

 

 

Greets,

 

 

Gio
..forgot...

 

explode list first before going to statistics calculator (as u remerge with the grid trough a featuremerger you dont need to pass the geometry, unless ofcourse if u want or need to).
Hi,

 

 

If you create features which have "Grid_id", "cover_type" and "percentage" as their attributes, you can use the BulkAttributeRenamer to rename "percentage" to associated "cover_type" value (i.e. one of land cover type names) for every feature.

 

For example, assume cover type names are "forest", "agricultural", "residential", "road", etc. (16 type names).

 

 

1) Parameter settings of the BulkAttributeRenamer are:

 

Rename: Selected Attributes

 

Selected Attributes: percentage

 

Action: Regular Expression Replace

 

Text To Find: .*

 

String: cover_type   set as Attribute Value

 

 

2) Expose 16 cover type names with the AttributeExposer.

 

Attributes To Expose: forest, agricultural, residential, road, etc. (16 type names)

 

 

3) Aggregate the features with the Aggreagor grouping by "Grid_id".

 

Group By: Grid_id

 

Keep Input Attributes: Yes

 

 

If you need to set 0 to <missing> percentage, can use the NullAttributeMapper (FME 2014) after the aggregation.

 

Map: Selected Attributes

 

Selected Attributes: forest, agricultural, residential, road, etc. (16 type names)

 

If Attribute Value Is: Missing (Selected Attributes Only)

 

Map To: New Value

 

New Value: 0

 

 

Hope this helps.

 

 

Takashi
Thanks for answers everyone, i actually just used the AttributePivoter (and a few other transformers) to do this in the end, though i did find AttributePivoter tricky at first.

 

S

Reply