# Habitat connectivity -- how to map connectivity between polygons based on a separate polygon layer

I have a polygon layer representing a habitat type and another polygon layer representing water features. I want to be able to assign to each water feature whether it shares a connection via a habitat polygon with another water feature or not (within a distance radius). A complication is that if I use buffers to represent the distance radius, they overlap. An additional complication is that I've tens of thousands of the water features.

I've experimented with different solutions using intersections, but I've not been able to come to a solution. Anybody have any idea? I think that this is kind of a FRAGSTATS or Patch Analyst problem, but with vector and with many tens of thousands of landscapes to run it on.

In the image below, orange polygons are water features and the green area is the habitat (the black circles are 1 km buffers).

In the map above, water features 20957 and 20882 are obviously not connected via the habitat to any other feature, nor is feature 44444 (which is connected to the habitat but not connected by the habitat to any other feature). On the other hand, there are definitely connections for 21077, 21044, 20993 and 37716, while there is no connection within 1 km for feature 21655. I don't need to know the IDs of the connecting features, or even a count, just whether or not there does exist a connection to another feature within a 1 km buffer.

• Would you be able to edit your question to include a diagram of a small example area of what you are trying to describe, please? I suspect that a combination of Intersect and Poylgon Neighbors, and probably some ArcPy would do it.
– PolyGeo
Aug 22, 2014 at 21:54
• Water features are all polygons? I don't see the problem with overlapping buffers - doesn't that area in part define the connection you're looking for? If I'm understanding the problem right, I can outline a workflow that uses Intersect or Union, some selections, and Delete Identical to identify the water features connected by habitat corridors less than x distance. Aug 23, 2014 at 5:30
• I'm attaching this map to show the problem if this will help. The orange polygons are water features and the green area is the habitat (the black circles are 1 km buffers). <img src="lh5.googleusercontent.com/-ltpNow5wxGs/U_syD5IOZqI/AAAAAAAAA_M/…"> Aug 25, 2014 at 13:11
• In the map above, water features 20957 and 20882 are obviously not connected via the habitat to any other feature, nor is feature 44444 (which is connected to the habitat but not connected by the habitat to any other feature). On the other hand, there are definitely connections for 21077, 21044, 20993 and 37716, while there is no connection within 1 km for feature 21655. I don't need to know the IDs of the connecting features, or even a count, just whether or not there does exist a connection to another feature within a 1 km buffer. Does this help? Aug 25, 2014 at 13:12
• It's generally best to edit your question using the button at the lower left (just below the tags) to supply additional information rather than post a long trail of comments - particularly if there are images. The more complete your question without having to read a trail of comments or click through various links to get the full story, the better. I'll go ahead and do that to give you an example, then outline a process that should get you what you want. Aug 25, 2014 at 19:46

It appears your data was originally raster, so there may be some other tools/approaches using that format. I'm also not sure why your 1km buffers are circles - if you're actually buffering polygons (which my answer assumes you do), they should be the same general shape as the polygon. This method will produce several intermediate layers to arrive at the result.

An optional first step is to reduce your dataset. As you've noted, you'll have some water features and habitat polygons that aren't needed since they don't touch. You could start by making a copy of the two layers then selecting all water features that do not intersect a habitiat polygon and deleting them, then doing the same for habitat polys that don't intersect a water feature.

1. Buffer your water features by x (1km?) with Dissolve set to NONE.
2. Intersect the new buffer layer with itself to get all areas within x of two water features.
3. Step 2 creates some extra geometry it would be convenient to get rid of. You can use Delete Identical to get rid of stacked buffer geometries. You could also use Dissolve at this point, which would also combine the adjacent and stacked polys. Then you'll want to select and delete all buffer polys that do not touch the boundary of a water feature to get valid connecting corridors. This is because if you have two just out of range, you'll get a buffer area between but it won't touch either one.
4. Intersect remaining buffers with the habitat polygons. With the results you'll again repeat Step 3 to clean up the geometry and delete unecessary polys. You may end up with corridors that only touch one water feature, for instance if a corridor reaches between two but the habitat doesn't. Selecting those that touch at least two may require a Spatial Join between water features and corridors, keeping all records and doing a one to many, then examining the join count and selecting only those greater than one.
5. Now if you select water features that touch your final buffer layer, those should be what you want to flag. You can add an field to the attribute table and use Field Calculator to put a value into the selected records only. For example field Connected with a default value of 0 for false, and field calculate a value of 1 for true into the selected records.

Union could also be used between the habitat and initial buffer polygons. With a dissolve it would generate the needed cooridor polys with fewer steps, but decoding and deleting the attribute relations, as well as all the extra geometry, might take just as much work.

Just comment if you have any questions, run into problems, or would like some illustrations.

• Thanks, @Chris W, I'll try that workflow. Also appreciate the message about editing questions -- this was my first time asking a question here. Aug 26, 2014 at 12:34
• Sorry about the late reply, @Chris W, I got busy with other work. But your solution worked great. Thank you. Sep 18, 2014 at 18:12

A beautifully made description of a sophisticated way to do this. Funny, to me it looks like vector (maybe your buffers are raster?), but I am still a newbie. What occurred to me that might be easier is to create a new layer and digitize the line with the mouse as you wish it, using the imagery of the layers pictured here. The buffers there make it easier, but if you've got miles and miles to cover it might be better to use selection tools as described.

To me, this seems very similar to simple pathfinding algorithm in computer gaming. In games, they have tiles, and oftentimes, they need to find a path between a tile of a certain type to a tile of the same type, without leaving that type of tile. A simple example of this is the A* algorithm. Might be a bit overkill for what you are trying to do, but here is a link to an explanation:

http://www.raywenderlich.com/4946/introduction-to-a-pathfinding