sedona icon indicating copy to clipboard operation
sedona copied to clipboard

Is ST_Distance returning a distance in miles given lat/long

Open keeyong opened this issue 8 years ago • 6 comments

Another question since I couldn't find this answer from the Web.

I have a dataframe with lat/long coordinates. Now I am computing distances between them using ST_Distance and am wondering if it returns in miles or kilometers?

keeyong avatar Aug 10 '18 17:08 keeyong

@keeyong Please read ST_Transform: http://datasystemslab.github.io/GeoSpark/api/sql/GeoSparkSQL-Function/#st_transform

jiayuasu avatar Aug 11 '18 10:08 jiayuasu

Thanks!

keeyong avatar Aug 11 '18 16:08 keeyong

@jiayuasu sorry to bother again. I looked around ST_Transform examples but it is not very clear to me how to use it. My coordinate data is in lat/long and I want to compute the distance between them like ST_Distance(point1, point2).

Any example would be very helpful! Thank you again!

keeyong avatar Aug 11 '18 17:08 keeyong

Here is more concrete example.

I got 0.15981145178615555 from ST_Distance(POINT (-88.331492, 32.324142), POINT (-88.175933, 32.360763)). These two Points are in lat/long. The distance in miles should be 10.75. From a few example, I feel like multiplying 67.27 and the value of ST_Distance should do the magic.

keeyong avatar Aug 11 '18 20:08 keeyong

ST_Transform is to do coordinate reference system transformation. This will help you with the accurate distance calculation.

Please search on the internet. There are plenty of tutorials explain the concept.

The trick you use is no giving an accurate result. But good for testing.

On Sat, Aug 11, 2018 at 13:23 keeyong [email protected] wrote:

Here is more concrete example.

I got 0.15981145178615555 from ST_Distance(POINT (-88.331492, 32.324142), POINT (-88.175933, 32.360763)). These two Points are in lat/long. The distance in miles should be 10.75. From a few example, I feel like multiplying 67.27 and the value of ST_Distance should do the magic.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/DataSystemsLab/GeoSpark/issues/260#issuecomment-412299411, or mute the thread https://github.com/notifications/unsubscribe-auth/AKcRADjcCzN5jO65HhSWVe3ICnDluxAsks5uPz1UgaJpZM4V4kYZ .

--


Jia Yu,

Ph.D. Student in Computer Science

Arizona State University http://www.asu.edu/

Reach me via Jia Yu's Homepage http://www.public.asu.edu/~jiayu2/ | GitHub Repositories https://github.com/jiayuasu

Follow GeoSpark on Website http://datasystemslab.github.io/GeoSpark/ | GitHub https://github.com/DataSystemsLab/GeoSpark | Twitter https://twitter.com/GeoSpark_ASU

jiayuasu avatar Aug 12 '18 08:08 jiayuasu

Got it! Thanks!

keeyong avatar Aug 13 '18 17:08 keeyong