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

Alteryx Designer Desktop Discussions

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

Calculate the distance between two points

Inactive User
Not applicable

Hi,

 

I would like to calculate the distance between two points.

 

I have these data:

 

Point A and B with State, City, Address, Zip.

Also, I use ‘create points’ tool to get the longitude and latitude.

 

When I try to use ‘Distance’ tool to calculate the distance, I found there is only one input and there are no option to let me to input two different address/points?

Anyone have any ideas? Thank you!

12 REPLIES 12
Aguisande
15 - Aurora
15 - Aurora

Hi qqqwww,

You must have both points to compare in the data being input to the Distance Tool.

 

Can you give us a little bit more detail of you need to accomplish, like where are the points to be compared to, etc.?

 

michael_treadwell
ACE Emeritus
ACE Emeritus

Are your Points A and B both in the same column?

 

The distance tool requires two spatial fields (columns) to calculate the distance between. You may have to transpose your data so that you have two columns, [Point A] and [Point B]

Inactive User
Not applicable

 

For example, customer give me two address A and B.

I would like to caculate the distance between A to B.

For A, I have: State, City, Address, Zip

For B, I have: State, City, Address, Zip

 

Is it means that A and B should in the same row/record? Because there is only 1 input avaliable for tool 'distance'.

Thank you.

 

 

 

 

Aguisande
15 - Aurora
15 - Aurora

Yes, there is just one input, but the tool allows you to choose both Spatial objects to compare:

Capture.PNG

 

So, I recommend you to prep the records prior to calculate the distance between them, so you have them in the same row.

 

Inactive User
Not applicable

Thank you. It works now. I should trans the address to SpatialObject first.

david_berg
6 - Meteoroid

I have a slightly different issue trying to use the same tool.

 

I have one large polygon which I can bring in as a .shp or .kml file. I also have a .csv with a long list of lat longs, which are all located outside of the polygon, that I bring in and "Create Points" with using the WGS-84 reference system. What I would like to do is find the distance to the nearest point on the polygon for each lat/long in the list.

 

I have yet to figure out how to make it happen though... Since there is no way to connect multiple sources to the Distance Tool, I tried unioning the two files together but all of the distance calculations come back as null. 

 

Any help/thoughts would be greatly appreciated! 

 

RodL
Alteryx Alumni (Retired)

You would use the Append Fields tool to append the one polygon object to every record in your CSV. Then you would have the two spatial objects...the point and the polygon in each record.

I would suggest you check the Help on the Distance tool. For a point-to-polygon comparison, it should calculate to the nearest point of the polygon. 

Aguisande
15 - Aurora
15 - Aurora

Hi David,

Have you tried the Find Nearest Tool?

Insert both data sources (Your Csv and your Universe (Shapes)) and that's it.

 

Please, let me know if you succeded...

Bst,

_AG_

david_berg
6 - Meteoroid

Thank you, RodL.

 

The Append Fields tool was the key. I was trying to use Transpose...

 

Now all I need to do is add a throttle since the distanct to poly calculation seems to be quite resource intensive. 

 

Best,

David

Labels
Top Solution Authors