简体   繁体   中英

Find all points in DB which are in the radius of a lat and long

I have in DB SQL Server saved point in 2 fields- lat and long

I get point, and I want find all the points from my DB in radius of five minutes walking distance.

What's the best way to do it?

I read that there is a way to do it with GeoDanjo. But I understand that it doesn't work with SQL Server.

There also ways to do it if you save the data in geography type but it is not relevant either.

SELECT your-fields WHERE sqrt ( ( lat - lat1 )^2 + ( long - long1 )^2 ) < your-distance;

Where lat1 and long1 are your reference point values.

Very rough approximation for short distances (as someone noted in the comments).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM