- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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 ?
Thanks in advance,
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 |
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
the unit is UTM coordinates and should be fine. I am not sure if geodist accepts this input?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
According to the documentation, no. UTM coordinates are not an option. Coordinates can be degrees or radians.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
Document :http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003113162.htm
Suryakiran
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you have SAS/Graph, you can convert to degrees with PROC GPROJECT.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I don't think the UTM coordinates can be used in the SAS geodist function, try using the steps below to compute the distance
data test_distance;
set all_koordinater;
Long_diff = Longitude1 - Longitude2
Lat_diff = Latitude1 - Latitude2;
dist = sqrt ( Long_diff**2 + Lat_diff**2 );
distance = dist*0.000189394; * Convert feet to mile;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
GEODIST is for calculating geographic distances from latitudes and longitudes. UTM coordinates are expressed in meters from the equater (y value) and one of 60 central meridians (x value). So, within a given zone, the distance between two coordinates (in meters) is given by :
distanceInMeters = EUCLID(UTMx_1-UTMx_2, UTMy1-UTMy_2);