Welcome Guest, Not a member yet? Register   Sign In
Near Latitide&Longitide; for given postcode
#5

[eluser]veledrom[/eluser]
This is in KMs.


Code:
SELECT
     postcode,
     (((ACOS(sin(('51.546069024064' * PI() / 180)) * SIN((latitude * PI() / 180)) +
     COS(('51.546069024064' * PI() / 180)) * COS((latitude * PI() / 180)) *
     COS((('-0.235949008191785' - longitude) * PI() / 180)))) * 180 / PI()) * 60 * 1.1515 * 1.609344) AS Distance
    FROM postcodes
    HAVING Distance <= '1'
    ORDER BY Distance ASC


Messages In This Thread
Near Latitide&Longitide; for given postcode - by El Forum - 06-04-2012, 05:35 AM
Near Latitide&Longitide; for given postcode - by El Forum - 06-04-2012, 05:53 AM
Near Latitide&Longitide; for given postcode - by El Forum - 06-04-2012, 06:08 AM
Near Latitide&Longitide; for given postcode - by El Forum - 06-04-2012, 10:54 AM
Near Latitide&Longitide; for given postcode - by El Forum - 06-04-2012, 11:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB