[ create a new paste ] login | about

Project: PHPImpact
Link: http://phpimpact.codepad.org/cZym5qOO    [ raw code | fork ]

fedecarg - Python, pasted on Feb 8:
1
2
3
4
5
6
7
8
9
10
11
12
set @latitude=53.754842;
set @longitude=-2.708077;
set @radius=20;

set @lng_min = @longitude - @radius/abs(cos(radians(@latitude))*69);
set @lng_max = @longitude + @radius/abs(cos(radians(@latitude))*69);
set @lat_min = @latitude - (@radius/69);
set @lat_max = @latitude + (@radius/69);

SELECT * FROM postcode
WHERE (longitude BETWEEN @lng_min AND @lng_max)
AND (latitude BETWEEN @lat_min and @lat_max);


Create a new paste based on this one


Comments: