+ Reply to Thread
Results 1 to 7 of 7

Calculating areas of overlapping polygons

  1. #1
    Registered User
    Join Date
    03-01-2019
    Location
    North Carolina, US
    MS-Off Ver
    2018
    Posts
    6

    Calculating areas of overlapping polygons

    I am trying to calculate areas of overlapping polygons and there will never be more than two polygons. A person will generate a 2 series of coordinates that shape two overlapping polygons. I have limited excel abilities, and I kind of know how to manipulate and use macros but not really program them. Ive spent a few hours trying to get this thing to work but it isnt. I havent tweaked the macros I found on this and other forums, but I have brought them in to use. The macros are the following:

    IntersectComplex:
    Please Login or Register  to view this content.

    PtInPoly:
    Please Login or Register  to view this content.
    My idea was to generate seperate columns with the intersecting points and points found within each others shapes, stack them into one column, order them counterclockwise using angles between the X and Y points and ranking, and calculate the area. It works sometimes but not all the time.

    The issues always come up
    -A intersection point is missed
    -Points get drawn up incorrectly adding or subtracting from the actual area

    Attached is an example of the area. Blue and orange lines are overlapping each other, and the grey is the result.

    Is there a simpler way to do this?
    Attached Images Attached Images

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Calculating areas of overlapping polygons

    Why is the grey diagonal line (left-right upwards) in the external corner of the orange polygon regarded as being within the overlapping areas?
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Pendleton, OR
    MS-Off Ver
    Excel 2013
    Posts
    129

    Re: Calculating areas of overlapping polygons

    I am not sure why you are doing this in Excel. You might get more responses were you to post in the VBA Forum rather than the General forum. In the example you show the orange and blue polygons are both laid out in orthogonal fashion (all lines being east-west or north-south). If that would be the case, there would be easier ways to do this. Are the Polygons actually drawn by an Excel Range?

  4. #4
    Registered User
    Join Date
    03-01-2019
    Location
    North Carolina, US
    MS-Off Ver
    2018
    Posts
    6

    Re: Calculating areas of overlapping polygons

    Quote Originally Posted by johnnymac View Post
    I am not sure why you are doing this in Excel. You might get more responses were you to post in the VBA Forum rather than the General forum. In the example you show the orange and blue polygons are both laid out in orthogonal fashion (all lines being east-west or north-south). If that would be the case, there would be easier ways to do this. Are the Polygons actually drawn by an Excel Range?
    There will be more non-orthogonal layouts. I chose an excel forum, because I dont know what im doing. It seemed like a good place to start. Is there a way to move it into a VBA forum or do I just repost in the forum? and yes the polygons are from three excel ranges and a XY scatter plot
    Last edited by WibblyWobblyWifi; 03-04-2019 at 10:25 AM.

  5. #5
    Registered User
    Join Date
    03-01-2019
    Location
    North Carolina, US
    MS-Off Ver
    2018
    Posts
    6

    Re: Calculating areas of overlapping polygons

    Quote Originally Posted by Richard Buttrey View Post
    Why is the grey diagonal line (left-right upwards) in the external corner of the orange polygon regarded as being within the overlapping areas?
    Because the spreadsheet is only finding points that are intersecting or in the shapes, not the lines. The lines are created separately using the resulting angle from the arc-tan from the XY. That gets ranked from biggest to smallest to order a range that draws the shape counterclockwise. I think the points arent being ordered correctly or there is just a better way to do this.

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Calculating areas of overlapping polygons

    Quote Originally Posted by WibblyWobblyWifi View Post
    Because the spreadsheet is only finding points that are intersecting or in the shapes, not the lines. The lines are created separately using the resulting angle from the arc-tan from the XY. That gets ranked from biggest to smallest to order a range that draws the shape counterclockwise. I think the points arent being ordered correctly or there is just a better way to do this.
    Sorry, but I still don't understand the requirement.
    Your OP started with "I am trying to calculate areas of overlapping polygons and there will never be more than two polygons"

    Now to me that immediately conjured up a sort of Venn diagram picture where the area of interest is a that common area contained wholly withinin all the shapes - usually circles admittedly but infinite sided polygons can be regarded as special circles for this purpose.

    If the polygons were Excel shapes that I was going to suggest that VBA could be used to calculate the area of each shape in 'points' and then with some clever code deduce the common area by reference to the co-ordinate positions and the height and width of each shape.

    Obviously I'm mistaken and I don't really understand what is meant by an intersecting point. Maybe I'm being too literal but a point to me is like a nil dimension singularity and can't intersect with anything.

  7. #7
    Registered User
    Join Date
    03-01-2019
    Location
    North Carolina, US
    MS-Off Ver
    2018
    Posts
    6

    Re: Calculating areas of overlapping polygons

    Quote Originally Posted by Richard Buttrey View Post
    Sorry, but I still don't understand the requirement.
    Your OP started with "I am trying to calculate areas of overlapping polygons and there will never be more than two polygons"

    Now to me that immediately conjured up a sort of Venn diagram picture where the area of interest is a that common area contained wholly withinin all the shapes - usually circles admittedly but infinite sided polygons can be regarded as special circles for this purpose.

    If the polygons were Excel shapes that I was going to suggest that VBA could be used to calculate the area of each shape in 'points' and then with some clever code deduce the common area by reference to the co-ordinate positions and the height and width of each shape.

    Obviously I'm mistaken and I don't really understand what is meant by an intersecting point. Maybe I'm being too literal but a point to me is like a nil dimension singularity and can't intersect with anything.
    Yes, the plan is to end up with something like the venn diagram situation, though its not always just a partial overlapping. I dont know what you mean by excel shapes...everything is created in excel and the polygons wont always include 90 degree angles. I agree, VBA code can probably to do this, but i dont know VBA well enough so i tried something else first. Since the overlapping shape is created by points where the two shapes intersect and areas where a point is inside another, I used two created formulas I found online, those formulas are referenced in my main post. With the coordinates those formulas spit out, I graph them and get an area if possible.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Calculating # of Overlapping days with several date ranges and conditions
    By ZafferAhmed in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-30-2021, 05:44 AM
  2. Calculating overlapping date/time for Ambulances for a month
    By mpittmanfl in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-30-2019, 06:52 AM
  3. Calculating the overlapping time intervals
    By Mukund03 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-26-2015, 07:20 PM
  4. Calculating total for multiple overlapping values
    By tonyjackson in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-19-2014, 10:29 AM
  5. Calculating # of Overlapping days with several date ranges.
    By CarlSVM in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 01-06-2014, 07:09 AM
  6. Frequency Polygons what are they?
    By johnmw1 in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 03-02-2010, 03:44 AM
  7. Replies: 1
    Last Post: 03-20-2006, 03:40 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1