Create Lines between Polygons based on Polygon Attributes

529
2
12-17-2018 12:31 AM
ManuelCajuguiran
New Contributor II

How do I create a line between two polygons based on the polygons' attributes. For example, I want to show migration between polygons, Alaska and Wyoming. The Alaska polygon has an origin state attribute with value, "Alaska", and a destination state attribute with value, "Wyoming". Is there a geoprocessing tool or other process that will draw a line between the Alaska and Wyoming polygons based on these attributes. I'm trying to create a map  similar to this but based on states not counties:

American Migration [Interactive Map] - Forbes

0 Kudos
2 Replies
DanPatterson_Retired
MVP Emeritus

nothing automagic, but with the correct coordinates in the polygon layer table you could connect the centroids of the polygons

Add Geometry Attributes—Data Management toolbox | ArcGIS Desktop   using the centroid coordinates for the two polygons. 

Create a new *.csv text file containing

alaskaX, alaskaY, wyomingX, wymoningY   as the header, then add the coordinates of the centroid on the next line

  12124,   123132,  12312,       123123         more appropriate values obviously

Use the csv file and ...

XY To Line—Data Management toolbox | ArcGIS Desktop 

to make the geodesic between them.  Make sure you use define the coordinate system being used (Define Projection tool in arctoolbox) 

XanderBakker
Esri Esteemed Contributor

I created a tool a couple of years ago that works on a table that contains the from and to XY coordinates and creates the lines between them: https://community.esri.com/message/452166?commentID=452166#comment-452166 

Although this would require some pro-processing of the data, it could be done.