create irregular shaped polygons to an exact area/size

927
6
Jump to solution
01-19-2023 04:59 AM
davidchamberlain2
New Contributor III

Hi all,

I am trying to create polygons that are irregular in shape but must be of an exact area in sq metres when completed. So for one parcel I may need to have a polygon that covers 2400 sq m and another parcel that must be 2100 sq m. I cant find a way of easily doing this. One option would be to create the polygon roughly where it needs to be and then modifying it after, but if done this way I could do with the area being displayed at all times as I adjust vertices so I know when I have the exact size to then complete the polygon. Or create a polygon and then have an option to resize it to cover an exact area. 

Using constraints displays the distances between vertices in real time as you move the mouse, a way of resizing/modifying a completed polygon that displays the area on screen in real time as it changes would be ideal....something!!!

 

Any help is appreciated

 

Dave

0 Kudos
1 Solution

Accepted Solutions
davidchamberlain2
New Contributor III

Thank you @JohannesLindner , I will give that a try.

Thank you @JoshuaBixby 

View solution in original post

0 Kudos
6 Replies
JoshuaBixby
MVP Esteemed Contributor

You can't find an easy way to do it because there is no easy way to do it.  It is regularity that allows for consistent shape and size polygons to be created.  Once regularity goes out the window, there are countless shapes that can meet the same size. 

In your case since talking about parcels, which generally are more regular (even the irregular ones) than not, I am guessing you are not looking for some amorphous blob that is 2400 sq m exactly.  For anyone to offer suggestions, you will have to elaborate more on the constraints around "irregular."

davidchamberlain2
New Contributor III

ok, so the polygons are to be plotted on farmland to illustrate where trees will be planted. So the shape of the polygons are essentially random. I think the best I can hope for is some way to display the area of the polygon in sq metres as it is adjusted. A visible measure of the area as it changes shape due to me moving a vertex etc. That way if I needed an exact area I could move a vertex or two until the desired area was reached without having to complete the changes and then go to the measure feature tool, and then go back to adjusting....and then back to the measure tool etc etc

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Is the polygon supposed to represent the areal coverage of the crown of a tree when they are mature?  Tree crowns can be reasonably approximated by ellipses of different dimensions.  Even if one wanted better representation of a tree crown than an ellipse, no tree crown in reality is going to have an "exact area."

0 Kudos
davidchamberlain2
New Contributor III

No, these are parcels of land where many individual trees will be planted. So the areas vary in both shape and size depending on the land where they are to be planted. Due to budgets and reports I need to know exactly how much land has been allocated for this, both before and after planting. There are restrictions on how much land I can allocate and also reports to complete afterwards. This is why I need to know the exact areas of the polygons as I try to fit them into the landscape, I have a certain size of parcel I then have to tweak in shape to make a best fit onto the land I have permission to use.

0 Kudos
JohannesLindner
MVP Frequent Contributor

While you won't get around doing things manually, you can at least make it easier.

 

Label your features with the area

That way you don't have to switch tools. The label won't update while you modify vertices, so you still have to complete the edit before seeing the new area. Use a label expression like this:

Round(Area($feature, "square-meters"), 2) + " m²"

 

 

Use Attribute Rules

Create a new double field in you polygon feature class. This field will store the target area.

Create an Attribute Rule for your polygon feature class. Use this expression (use the new field's name in line 7!):

// Calculation Attribute Rule
// field: Shape
// Triggers: Insert, Update


// if you did not specify a target area, return the current geometry
var target_area = $feature.DoubleField
if(target_area == null) { return Geometry($feature) }

// these two parameters specify how close the rule will get to your target area
// the rule will keep on trying to get to your target area until one condition is met:
// either the relative error (target-current)/target drops below max_rel_error
// or the number of tries goes above max_iter.
// at that point, the rule returns the current try.
// decreasing max_rel_error and increasing max_iter returns better results, but it takes much more time.
var max_rel_error = 0.001
var max_iter = 200

var current_geometry = Geometry($feature)
var rel_error = (target_area - Area(current_geometry, "square-meters")) / target_area
for(var iter = 0; iter < max_iter; iter++) {
    current_geometry = Buffer(current_geometry, rel_error, "meters")
    rel_error = (target_area - Area(current_geometry, "square-meters")) / target_area
    if(Abs(rel_error) <= max_rel_error) { break }
}
return current_geometry

 

The workflow would be something like this:

  • create a rough outline of where you want the trees to be
    JohannesLindner_0-1674212877017.png

     

  • Change the value of your target area field (DoubleField in my test data). The rule triggers and tries to get the polygon as close to the target area as possible.
    JohannesLindner_1-1674213070207.png

     

  • Delete the target area value. That hinders the rule from constantly changing you polygon in the next step.

  • Use the Edit Vertices tool to iteratively change vertices until you hit your target area. Remember, the label isn't updated while you drag a vertex, so you will have to complete the edit to see the new area.
    JohannesLindner_2-1674213457219.png

     


Have a great day!
Johannes
0 Kudos
davidchamberlain2
New Contributor III

Thank you @JohannesLindner , I will give that a try.

Thank you @JoshuaBixby 

0 Kudos