Calculate Distance between Two Points (Longitude and Latitude)

5381
8
02-21-2018 01:54 PM
AngieJun
New Contributor

I have two layers of data plotted in ArcGIS Pro by latitude and longitude called Facilities, and the other layer is called Communities. I am looking to measure the distance in miles and feet from Facilities to Communities and join on a region code. I would lastly like to export the result to a table and plot on a map. If you could please help I would appreciate it. Thank you.

0 Kudos
8 Replies
DanPatterson_Retired
MVP Emeritus

Generate Near Table depending on exactly what you want will help if you use geodesic distance.

Your work would be simpler if you project your data first in any event.

The join is a separate issue which you might have to clarify with an example

shan_sarkar
Occasional Contributor III

Angie,

You may even use the Spatial Join—Help | ArcGIS Desktop with the closest match option.

~Shan


~Shan
0 Kudos
XanderBakker
Esri Esteemed Contributor

The distance that you are looking for, is that the distance "as the crow flies" or are you interested in the shortest route using a road network? Since you want to "join" the locations based on region code, you might want to add the coordinates are attributes to the featureclass(es) join on the region attribute and calculate the distance between the two coordinate pairs (probably have to project them to do that correctly). Is there just one facility and one community per region, or should it connect to the nearest?

0 Kudos
AngieJun
New Contributor

I am mainly interested in distance "as the crow flies". In the facilities layer, there are roughly about 1,000 facilities, and in the communities layer, there are roughly 1,000 of those. Each facility may connect to several communities based upon the region code, but I only want to calculate the distance from the community to the nearest facility because I have so many locations. 

0 Kudos
DanPatterson_Retired
MVP Emeritus

Project tool in arctoolbox... there is the same on in ArcMap and ArcGIS PRO for future proofing

0 Kudos
XanderBakker
Esri Esteemed Contributor

If you are interested in the nearest feature, you should be using the Near—Help | ArcGIS Desktop tool since it will return the nearest feature from the other layer (advanced license required) or as Dan suggested the Generate Near Table—Help | ArcGIS Desktop  using the CLOSEST option. There is a caveat though. This will not take the region into account. If the nearest feature is located in another region and not the same region, it will return the wrong feature.

It can be scripted, but in that case it would be good to have access to both featureclasses to help you with this.

0 Kudos
AngieJun
New Contributor

I apologize, I am brand new to working with geographic data. What does it mean to "project" your data first? 

0 Kudos
XanderBakker
Esri Esteemed Contributor

I meant, that when you simply apply some Pythagoras to two sets of coordinates expressed in decimal degrees you will end up with a "distance" expressed in decimal degrees, which is not what you want. One way to prevent this from happening is to project data which has a geographic coordinate system to a projected coordinate system. Some reading on this can be found here: Coordinate systems, projections, and transformations—Properties of maps | ArcGIS Desktop  and this presentation from last UC: http://proceedings.esri.com/library/userconf/proc17/tech-workshops/tw_515-279.pdf 

0 Kudos