How to compute overlapped area of polygonABC by polygonXYZ

723
4
02-23-2011 11:27 AM
ESRICustomer
New Contributor III
My Environment
[INDENT]ArcEngine 9.3.X[/INDENT]
[INDENT]Visual Studio 2008[/INDENT]
[INDENT]VB.NET[/INDENT]

I have been scouring the forums and documentation for a way to do this.
Please refer to the attached image to follow along with my question.

I am looking for a way to compute the area of the overlapped portion of FeatureABC on AlphaLayer, by FeatureXYZ on BetaLayer.

I'll tell you below what I've examined so far. Please read that before answering, as this topic is very easily misunderstood.

I dont think a spatial query ISpatialFilter is appropriate for what I am looking for because that only tells me what RELATIONSHIP features share with each other, such as
FeatureABC intersects FeatureXYZ.

What I need to know is not "IF" they intersect, overlap, etc, but rather exactly "HOW MUCH" intersection, overlap, etc there is.

The IRelationalOperator is no help with this either. Like a spatial query, it only reveals whether or not there is a relationship, but does not quantify "how much" that relationship is.

I also don't think that the ITopologicalOperator will work as it literally modifies the polygon being examined. I do not want to modify any existing feature polygons.

I don't think GeoProcessing Tools will work because they want to create additional layer files, etc. Very messy. There has to be a simpler way than creating additional layers, then loading them, then examining them, then unloading them, then deleting them. That's rediculous.

I don't believe that envelopes will work either because if envelopes can only be square or rectangular shaped, then clearly they cannot tell me the area as pictured in the attachment, as it is random shaped, not rectangular. All examples I have seen with Envelopes, they are always rectangle shaped, and nowhere in the documentation does it even suggest that an envelope can be anything but a rectangle. I would need an envelope whose shape exactly matches that of the polygon in question.


The solution requires two critical parts
(1) I be able to do this without modifying or affecting the polygons participating in the operation.

(2) I don't want to create any new layers or features which must be added to my map in order to compute this. I just want something I can do in memory and easily throw away.
So if your suggested technique requires that a new polygon be created, but in memory only, and I can examine it through a reference to it, but it does not participate in my map in any way, that's fine.

I'm still in shock that this isn't a massively popular topic as I've yet to find anything in the documentation on this exact idea, nor apparently has anyone attempted it in the forums.
So please don't point me to another forum post which is only remotely related to this topic as I have already looked at hundreds of them, and none appeared to be relevant.

Thanks a lot.
I'm sure your suggestion will help lots of people... if not in the past, then in the future.
0 Kudos
4 Replies
MelitaKennedy
Esri Notable Contributor
My Environment 
[INDENT]ArcEngine 9.3.X[/INDENT] 
[INDENT]Visual Studio 2008[/INDENT] 
[INDENT]VB.NET[/INDENT] 

I have been scouring the forums and documentation for a way to do this. 
Please refer to the attached image to follow along with my question. 

I am looking for a way to   compute the area of the overlapped portion of FeatureABC on AlphaLayer, by FeatureXYZ on BetaLayer. 

I'll tell you below what I've examined so far. Please read that before answering, as this topic is very easily misunderstood. 

I dont think a spatial query   ISpatialFilter is appropriate for what I am looking for because that only tells me what RELATIONSHIP features share with each other, such as  
FeatureABC intersects FeatureXYZ.  

What I need to know is not   "IF" they intersect, overlap, etc, but rather exactly   "HOW MUCH" intersection, overlap, etc there is.  

The   IRelationalOperator is no help with this either. Like a spatial query, it only reveals whether or not there is a relationship, but does not quantify "how much" that relationship is. 

I also don't think that the   ITopologicalOperator will work as it literally modifies the polygon being examined. I do not want to modify any existing feature polygons. 

I don't think   GeoProcessing Tools will work because they want to create additional layer files, etc. Very messy. There has to be a simpler way than creating additional layers, then loading them, then examining them, then unloading them, then deleting them. That's rediculous. 

I don't believe that envelopes will work either because if envelopes can only be square or rectangular shaped, then clearly they cannot tell me the area as pictured in the attachment, as it is random shaped, not square. All examples I have seen with Envelopes, they are always square shaped, and nowhere in the documentation does it even suggest that an envelope can be anything but a rectangle 
I would need an envelope whose shape exactly matches that of the polygon in question. 


The solution requires two critical parts  
(1) I be able to do this without modifying or affecting the polygons participating in the operation. 

(2) I don't want to create any new layers or features which must be added to my map in order to compute this. I just want something I can do in memory and easily throw away. 
So if your suggested technique requires that a new polygon be created, but in memory only, and I can examine it through a reference to it, but it does not participate in my map in any way, that's fine. 

I'm still in shock that this isn't a massively popular topic as I've yet to find anything in the documentation on this exact idea, nor apparently has anyone attempted it in the forums. 
So please don't point me to another forum post which is only remotely related to this topic as I have already looked at hundreds of them, and none appeared to be relevant. 

Thanks a lot. 
I'm sure your suggestion will help lots of people... if not in the past, then in the future.


I am pretty sure you will need to do this in a few parts. First, use ShapeCopy for one of the input geometries. Then, use ITopologicalOperator5::Intersect or ITopologicalOperator6::IntersectEx to return a geometry that is the intersection of the two features. You will then have to calculate the area of this geometry with IArea.

You may optionally want to project the intersection geometry into an equal area-based projected coordinate system.

Melita
0 Kudos
LeoDonahue
Occasional Contributor III
Start here, with the Object Model diagram:
http://help.arcgis.com/en/sdk/10.0/Arcobjects_net/pdf/GeometryObjectModel.pdf

Notice that Polygon has the ITopologicalOperator Interface.

Notice also on that diagram, that ITopologicalOperator also has a method called "Intersect", as Melita pointed out already.

Now, let's look here at the API for ITopologicalOperator:
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/002m/002m000003vs000000.htm

And there is sample code at the bottom ("ViperPinForm" - look for Private Sub SetPINValue(). 

You'll have to modify it to suit your needs, but it outlines the general idea Melita provided.

1191011089911110910132989799107443210697991079711511546
0 Kudos
ESRICustomer
New Contributor III
I am pretty sure you will need to do this in a few parts. First, use ShapeCopy for one of the input geometries. Then, use ITopologicalOperator5::Intersect or ITopologicalOperator6::IntersectEx to return a geometry that is the intersection of the two features. You will then have to calculate the area of this geometry with IArea.

You may optionally want to project the intersection geometry into an equal area-based projected coordinate system.

Melita


I was going to mark this thread as answered with your suggestion, but apparently that's not possible anymore since moving to these new forums.  Seems kinda stupid that we can't do that now.
0 Kudos
MelitaKennedy
Esri Notable Contributor
I was going to mark this thread as answered with your suggestion, but apparently that's not possible anymore since moving to these new forums.  Seems kinda stupid that we can't do that now.


😄

I think Leo's answer is probably better! Yes, a lot of people would like that type of functionality. The group involved is looking at several possibilities. Check out the

Resource Center Site Feedback forum

For instance, the sticky Wish List thread.

Melita
0 Kudos