Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Calculate common border between two spatial objects

julsto93
5 - Atom

Hi All,

 

I have a file full of spatial objects. My goal would now be to calculate the length of the common border between two touching spatial objects. I can find easily enough all the objects, that do touch each other. However I find it hard to figure out how long the shared border is...

Any input would be very welcome.

 

Best

3 REPLIES 3
T_Willins
14 - Magnetar
14 - Magnetar

Hi @julsto93,

 

Use a Spatial Match tool and bring in one object in the T anchor and the other object in the U anchor.  Set the tool to "Where Target Touches Universe".  Attach a Spatial Info tool to the U output anchor and set to Length (Kilometers) or Length (Miles).  This should give you the distance of the common border.

CharlieS
17 - Castor
17 - Castor

Hi @julsto93 

 

This is an interesting spatial project that takes a couple tricks since the "Touches" relationship doesn't output a spatial object to measure. 

 

- The first trick is knowing that there's a spatial function in the Formula tool (that doesn't exist in the Spatial tools) called ST_Boundary(. This will take a polygon input and output the line object of the polygon border. 

 

- The second important bit of information is knowing what spatial object type will be returned from each type of intersection. Line to line returns a point, so we need polygon to line, which returns the line. Using this information we'll intersect the boundaries from the first step against the original polygons.

 

- Now we have the intersecting lines! The only problem is that depending on how the spatial objects were drawn, parts of the boundary may only match to one side of the match or another. So the Transpose, Summarize, and Join tools you see at the end are finding unique pairs, combining the boundaries from both sides, and applying it to all the original records. 

 

Check out the attached example where I calculate the border lengths of neighboring ZIP polygons.

 

20200309-BorderLength.PNG

md517t
6 - Meteoroid

@CharlieS 

Thank you for suggesting the ST_Boundary formula.  I had an area that I needed create an internal buffer that followed a state shoreline.   Using -0.5 miles in the buffer tool created an internal buffer but it touched the state boundary.  I needed the buffer to be fully contained within the state boundary but not touch.  After creating the -0.5 mi buffer, I used the ST_Boundary tool to create a 0.1 mi buffer around the polyline of the state boundary.  This then allowed me to use the Spatial Process tool and cut the polyline buffer from the internal shoreline buffer.  This created a buffer that followed the shoreline contour internally but not touch the state boundary itself.

Labels