Select coordinates which fall within a radius of a central point?

I have a database of coordinates in the schema:

ID:Latitude:Longitude:name:desc

I’ve set up my google maps application to show the markers effectively on the screen. However I need to add another feature whereby the user can view all pointers that fall within the radius from a central point.

How would I write up a sql statement of the kind:

Select all pointers that fall within a 10 mile radius of X & Y

Soruldu üzerinde 9 Haziran 2014 Technology.
Yorum Ekle
2 Cevap(lar)
En iyi cevap

A lot of people haven’t seen Vanilla Sky because it has Tom Cruise in it. Let me tell you, it’s not only his best movie, it’s one of the best movies ever made.Not having seen this is almost like not having seen the first Matrix.

üzerinde 9 Haziran 2014 cevapladı.
Yorum Ekle

The SQL below should work:

SELECT*FROM Table1 a 
WHERE(
          acos(sin(a.Latitude *0.0175)* sin(YOUR_LATITUDE_X *0.0175)+ cos(a.Latitude *0.0175)* cos(YOUR_LATITUDE_X *0.0175)*    
                 cos((YOUR_LONGITUDE_Y *0.0175)-(a.Longitude *0.0175)))*3959<= YOUR_RADIUS_INMILES
      )
üzerinde 9 Haziran 2014 cevapladı.

aaaa

üzerinde 9 Haziran 2014.
Yorum Ekle

Cevabın

Bu cevabı göndererek, kullanım koşulları ve gizlilik kurallarını kabul etmiş olursunuz privacy policy and terms of service.