2

I am looking to determine how much of the area of 1 polygon (Lets say a body of water for instance) falls completely with in another polygon (Call it a state or county for instance) i have a layer that contains all of the area covered by water and another layer that has all of the county boundaries. I have selected the specific county that I am interested (creating a new "table" called selection). I cannot get the syntax correct on my SQL query in MapInfo.

I believe I am looking to count the area of the object in the first layer that falls within the selection object but the syntax evades me.

Picture: enter image description here enter image description here

  • 1
    Do you want the area only when the water polygon is completely within the County Boundary object, or do you want the area for partial overlap? – T_Bacon Jun 18 at 7:34
  • 1
    Also, do you want a sum of the area for all water bodies that are within a county or an individual area for each water body? – T_Bacon Jun 18 at 7:46
  • T_Bacon. Thanks for the Response I am looking for a sum of the area for all bodies of water contained within a county and in this case i do not want to overlap the boundary. I was able to get it done with your sage advice below thank you very much! – Nathan Jun 18 at 15:14
  • That's great. If my answer worked for you then please could you mark is as an accepted answer? – T_Bacon Jun 19 at 7:01
3

As it's not 100% clear whether you want to include areas of partial overlap or not I'll provide both an option for only areas of total overlap (where the water body is completely contained within the county) and one where partial overlap is included within the output.

To pull out the area of overlap for water bodies that are completely contained within a county boundary, the following should work:

Select: County.ID, Water.ID, Area(Overlap(County.obj, Water.obj), "sq mi")

From: County, Water

Where: Water.obj Entirely Within County.obj

To include water bodies that partially overlap it's a simple change to the where condition to check for intersection rather than entire overlap:

Where: Water.obj Intersects County.obj

If you want a Sum of the area for each County then you'll need to add a Sum aggregate function to the selection fields and a Group By field. Again, you can interchange the where condition as specified above depending on whether you want to include partially overlapped objects or not.

Select: County.ID, Water.ID, Sum(Area(Overlap(County.obj, Water.obj), "sq mi"))

From: County, Water

Where: Water.obj Intersects County.obj

Group By: County.ID

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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