# Get polygon from within another polygon

246
6
09-18-2019 07:56 AM
New Contributor III

Trying to look for how to do this and I'm kind of at a loss here.. Here's my dilemma:

I have a polygon shape, and I want to use that shape and get only the polygon data from 2 other layers that are only within that shape. Once I get those I'm going to union the resultant polygons but what would be a good second step for this? First step is getting the polygon I want to use. I did read about the clip geometry tool but it looks like from what I'm reading, that only clips on a selected extent, and not an actual input geometry. Any guidance would be wonderful. Thanks!!

Tags (2)
6 Replies
MVP Esteemed Contributor

Dean,

so the first step is to query the two other layers using a QueryTask and the input polygon as the queries geometry. Then you can take the results of those queries and do your step two.

New Contributor III

Ok thats pretty simple.. The only other question I have would be what spatial relationship would I use for that? (I should have mentioned that earlier) Then I can union all 3 polygons and make the final graphic right? Or just use the two?  I'm asking this because I need to show the union on the map within the parcel polygon only.. amongst other things that need done with this. lol. Thanks for the quick reply on this too Robert.. You're a wealth of knowledge.

MVP Esteemed Contributor

Dean,

That depends. Do the polygons have to be completely contained in the selection polygon or can they just intersect?

Then I can union all 3 polygons and make the final graphic right? Or just use the two?

Unioning all three would not make much sense as that would basically be the selection polygon that you started with. Maybe you would explain more about you goal. Are you looking for the symmetrical difference of the polygons or...?

New Contributor III

1) The polygons need to be completely contained in the selection polygon.

2) What I'm doing is searching on a parcel geometry for land use and soil types so I want to show the land use and soil types within the parcel polygon.  Hopefully that makes sense..

MVP Esteemed Contributor

1. Then your spatial relationship is contains

2. So why do you have to union anything. I am still unclear.

New Contributor III

They want me to show data in a table combined with both soil and land use.  I guess drawing it I won't need to unionize it. Maybe I'll go back to rethink that part of it. Typing it out makes me think we should have a different approach then what they did before. This was an arcmap add-on written in VB that's being ported over to a web application using the javascript api.