Question

finding percentage of a area within other areas

  • 22 December 2015
  • 13 replies
  • 93 views

Badge

So I am trying to work on a capstone project I am creating and one aspect of it is to figure out what counties all the national parks are in and what percentage of each county does the park take up if it is in it.

My thinking is to use the "area on area overlay" and then the "percent overlap". Any ideas or suggestions on how to get this done it would be great. I am just in the initial brain storming and so far my trials in FME have not gotten me what I am trying to achieve. I really just need the percentages the parks are in each county for an appendix for the project I am working on.

I dont know if this matters but the files are a shapfile with all US counties and the other is a shapefile with the US Parks in it as polygons.


13 replies

Userlevel 2
Badge +16

The challenge here is that both are areas (parks and counties).

So calculate the Parkarea per park using the AreaCalculator (before overlaying).

Then do the AreaonAreaOverlayer, and calculate the area of the overlaying parts.

Divide the last calculated area by the total Parkarea and you have the part of the park in a specific county using an ExpressionEvaluator.

A catche: you may have to group multiple areas by countyname as the AreaonAreaOverlayer can create multiple areas for the same county (Aggregator grouping by countyname and parkname) before doing the percentage calculation or even the area calculation of the overlays.

Badge +3

Hi,

Extract area (with names like Park_area and Countyu_area) before sending objects to the AoA.

Use list on Aoa.

After Aoa, do a area calculator, name it creatively.

Test for overlaps > 0 (no need to calculate none overlappings) and the explode the list. and do

Overlaps have both park_area and county_area as well as the areas of the overlaps needed to do simple math to get the percentage.

You can use statisticcalculator to group results by park and county.

(thats basicaly what the percent overlaps does, i assume)

Badge

Hi,

Extract area (with names like Park_area and Countyu_area) before sending objects to the AoA.

Use list on Aoa.

After Aoa, do a area calculator, name it creatively.

Test for overlaps > 0 (no need to calculate none overlappings) and the explode the list. and do

Overlaps have both park_area and county_area as well as the areas of the overlaps needed to do simple math to get the percentage.

You can use statisticcalculator to group results by park and county.

(thats basicaly what the percent overlaps does, i assume)

What do you mean extract area? What tool would that be?

Userlevel 4
Badge +13

What do you mean extract area? What tool would that be?

He means use the AreaCalculator

Badge

He means use the AreaCalculator

Thank you, i did not put them togeather when reading.

Userlevel 2
Badge +17

Alternatively, the Clipper can be used in this case.

Assuming that the county features have a unique ID attribute (e.g. unique name or code). If they don't have ID, add unique ID attribute to every county feature at first.

  1. Add a Clipper to the workspace. Send the county features to the Clipper port, send the national park features to the Clippee port of the Clipper. Check the "Merge Attributes" checkbox in the parameters dialog, so that the ID attribute of the Clipper feature (county) will be merged to the clipped feature (parks).
  2. Calculate the area (e.g. "_park_area") of each clipped feature (park), which will be output through the Inside port of the Clipper.
  3. Use the Aggregator to aggregate the clipped features. Specify the county ID to the "Group By", and specify "_park_area" to the "Attributes to Sum" parameter. With this setting, the resulting feature will have "_park_area" attribute which stores the sum of park areas within the county.
  4. Merge the resulting features from the Aggregator to the original county features with the FeatureMerger, using the county ID as join key.
  5. For the features from the Merged port of the FeatureMerger, calculate the required percentage using the ExpressionEvaluator or AttributeCreator (100.0 * "_park_area" / area of the county). If there are features from the NotMerged port, their park area can be considered as 0. i.e. there are no park areas within the NotMerged counties.

You can use the AreaCalculator transformer or the @Area function to calculate the area of a polygonal feature. The StatisticsCalculator can also be used to calculate the sum of park areas within each county, instead of the Aggregator.

Badge

Alternatively, the Clipper can be used in this case.

Assuming that the county features have a unique ID attribute (e.g. unique name or code). If they don't have ID, add unique ID attribute to every county feature at first.

  1. Add a Clipper to the workspace. Send the county features to the Clipper port, send the national park features to the Clippee port of the Clipper. Check the "Merge Attributes" checkbox in the parameters dialog, so that the ID attribute of the Clipper feature (county) will be merged to the clipped feature (parks).
  2. Calculate the area (e.g. "_park_area") of each clipped feature (park), which will be output through the Inside port of the Clipper.
  3. Use the Aggregator to aggregate the clipped features. Specify the county ID to the "Group By", and specify "_park_area" to the "Attributes to Sum" parameter. With this setting, the resulting feature will have "_park_area" attribute which stores the sum of park areas within the county.
  4. Merge the resulting features from the Aggregator to the original county features with the FeatureMerger, using the county ID as join key.
  5. For the features from the Merged port of the FeatureMerger, calculate the required percentage using the ExpressionEvaluator or AttributeCreator (100.0 * "_park_area" / area of the county). If there are features from the NotMerged port, their park area can be considered as 0. i.e. there are no park areas within the NotMerged counties.

You can use the AreaCalculator transformer or the @Area function to calculate the area of a polygonal feature. The StatisticsCalculator can also be used to calculate the sum of park areas within each county, instead of the Aggregator.

Would this process you think also work with state parks which could have multiple parks within a county and some of the parks would even overlap counties?

Userlevel 2
Badge +17

Would this process you think also work with state parks which could have multiple parks within a county and some of the parks would even overlap counties?

Yes, I think it works. However, I assumed that the parks themselves will not overlap each other. If the parks could overlap each other, insert the Dissolver to dissolve the clipped parks grouping by the county ID, before the step 2.

Badge

Alternatively, the Clipper can be used in this case.

Assuming that the county features have a unique ID attribute (e.g. unique name or code). If they don't have ID, add unique ID attribute to every county feature at first.

  1. Add a Clipper to the workspace. Send the county features to the Clipper port, send the national park features to the Clippee port of the Clipper. Check the "Merge Attributes" checkbox in the parameters dialog, so that the ID attribute of the Clipper feature (county) will be merged to the clipped feature (parks).
  2. Calculate the area (e.g. "_park_area") of each clipped feature (park), which will be output through the Inside port of the Clipper.
  3. Use the Aggregator to aggregate the clipped features. Specify the county ID to the "Group By", and specify "_park_area" to the "Attributes to Sum" parameter. With this setting, the resulting feature will have "_park_area" attribute which stores the sum of park areas within the county.
  4. Merge the resulting features from the Aggregator to the original county features with the FeatureMerger, using the county ID as join key.
  5. For the features from the Merged port of the FeatureMerger, calculate the required percentage using the ExpressionEvaluator or AttributeCreator (100.0 * "_park_area" / area of the county). If there are features from the NotMerged port, their park area can be considered as 0. i.e. there are no park areas within the NotMerged counties.

You can use the AreaCalculator transformer or the @Area function to calculate the area of a polygonal feature. The StatisticsCalculator can also be used to calculate the sum of park areas within each county, instead of the Aggregator.

Wow, you have answers to all of this. You are amazing what you know, Thank you again for the help.

Badge

Alternatively, the Clipper can be used in this case.

Assuming that the county features have a unique ID attribute (e.g. unique name or code). If they don't have ID, add unique ID attribute to every county feature at first.

  1. Add a Clipper to the workspace. Send the county features to the Clipper port, send the national park features to the Clippee port of the Clipper. Check the "Merge Attributes" checkbox in the parameters dialog, so that the ID attribute of the Clipper feature (county) will be merged to the clipped feature (parks).
  2. Calculate the area (e.g. "_park_area") of each clipped feature (park), which will be output through the Inside port of the Clipper.
  3. Use the Aggregator to aggregate the clipped features. Specify the county ID to the "Group By", and specify "_park_area" to the "Attributes to Sum" parameter. With this setting, the resulting feature will have "_park_area" attribute which stores the sum of park areas within the county.
  4. Merge the resulting features from the Aggregator to the original county features with the FeatureMerger, using the county ID as join key.
  5. For the features from the Merged port of the FeatureMerger, calculate the required percentage using the ExpressionEvaluator or AttributeCreator (100.0 * "_park_area" / area of the county). If there are features from the NotMerged port, their park area can be considered as 0. i.e. there are no park areas within the NotMerged counties.

You can use the AreaCalculator transformer or the @Area function to calculate the area of a polygonal feature. The StatisticsCalculator can also be used to calculate the sum of park areas within each county, instead of the Aggregator.

So i got this to work well, only issue i am having is that if counties have the same name then the statistics part takes all parts does the math but compares them to just one county with the name. This gives some counties would have 400% park coverage and only happens because it takes how much coverage is in all the counties with that name and then adds it all together and puts in first time the county is seen.

To work around i just used a attribute filter to split the incoming counties by state and ran separate tools for each one. So each state has its own area calculator, clipper, area calculator and aggregator and feature merger. And combined them back to one set of tools at the expression calculator down to the writer.

I am trying to clean it up so it is not so spider web like the way i have it. I know their has to be a better way than what I am doing it.

Userlevel 2
Badge +17

So i got this to work well, only issue i am having is that if counties have the same name then the statistics part takes all parts does the math but compares them to just one county with the name. This gives some counties would have 400% park coverage and only happens because it takes how much coverage is in all the counties with that name and then adds it all together and puts in first time the county is seen.

To work around i just used a attribute filter to split the incoming counties by state and ran separate tools for each one. So each state has its own area calculator, clipper, area calculator and aggregator and feature merger. And combined them back to one set of tools at the expression calculator down to the writer.

I am trying to clean it up so it is not so spider web like the way i have it. I know their has to be a better way than what I am doing it.

If the county features have both state name and county name as its attributes and the combination of them is unique for each county, you can use the combination (i.e. state name and county name) as group ID and join key. Alternatively, you can also use the Counter to add a sequential number attribute to every county feature as a temporary unique ID, before clipping.

Badge

Hi!

I've used the instructions on this page (the one using the clipper), since I'd like to know how much recreational land is within a certain service area (buffer zone) of each city in a region. The problem is that the method in the link above does'nt work for this, as far as I know, since the geographical buffer zones of the cities overlap each other. I'd like the final result to be a file with all of the cities and an attribute column with a number for the amount of recreational land (hectar) available.

I wonder if you could help me figure out how to achive this in FME? I am not looking forward to calculating this individually for each city, even though that would of course be an option.

I done this before, I need to find other BTS tower distance with current BTS tower.

I have my current BTS tower and all other lat & long

I writing program for windows. for solution I do this steps:

get current place lat & long

get all other lat & long in data table

check distance with math parameters and put the result in result column of data table

after that I add result lat & long in my map and show the distance map details

Reply