## Geo distance calculation GEODIST

Frequent Contributor
Posts: 87

# Geo distance calculation GEODIST

Hi,

I am stucked with this. I need to calculate distance in SAS between 2 set of coordinates. I only got UTM coodinates and

I use geodist function. But is does not create any output on distance and distance2.

Can you help or have some ideas ?

data test_distance;

set all_koordinater;

distance=geodist(GIS_koor_X,GIS_koor_Y,Latitude2,Longitude2)*1000;

distance2=geodist(726021,6272193,726031,6272193)*1000;

run;

 GIS_koor_X GIS_koor_Y Latitude2 Longitude2 736021,68 6272193,06 731728,9625 6273181,548 737435,51 6274983,35 731728,9625 6273181,548 737221,52 6274654,31 731728,9625 6273181,548 737043,37 6274223,31 731728,9625 6273181,548 747060,37 6274518,13 721728,9625 6273181,548 727043,37 6274223,31 721728,9625 6273181,548 727497,95 6272526,8 721728,9625 6273181,548 727056,14 6273195,25 721728,9625 6273181,548
PROC Star
Posts: 277

## Re: Geo distance calculation GEODIST

I think that your problem is the coordinates. The numbers should be in degrees, between 0 and 360, what you have is much too high.

Maybe you have the wrong unit.

I assume that your longitudes and latitudes are 10,000 times too big, but it could be something else.

``distance2=geodist(726021,6272193,726031,6272193)*1000;``

gives a missing value,

``````distance2=geodist(72.6021,62.72193,72.6031,62.72193)*1000;

``````

gives a distance of 111 meters and 59 centimeters. Is that what you expected?

Frequent Contributor
Posts: 87

## Re: Geo distance calculation GEODIST

the unit is UTM coordinates and should be fine. I am not sure if geodist accepts this input?

PROC Star
Posts: 277

## Re: Geo distance calculation GEODIST

According to the documentation, no. UTM coordinates are not an option. Coordinates can be degrees or radians.

PROC Star
Posts: 631

## Re: Geo distance calculation GEODIST

[ Edited ]

GEODIST() function cannot use UTM values as parameters. Convert those values to supported values. This function has a 5th argument <Options> (M- Miles, K- Kilometers, D-Degree and R- Radians) and the default will be 'D'. In your case it is interpreting the values as Degrees.

Thanks,
Suryakiran
PROC Star
Posts: 277

## Re: Geo distance calculation GEODIST

If you have SAS/Graph, you can convert to degrees with PROC GPROJECT.

Discussion stats
• 5 replies
• 85 views
• 2 likes
• 3 in conversation