c# 4.0 - Find nearby postcode with a base postcode -
this reference question: find uk postcodes closest other uk post codes matching post code string
--user wants postcodes nearby b193sh -- postcode = 'b193sh' -- latitude = 52.488460 -- longitude = -1.895690 select [housenumber], [street], [area], [postcode], [latitude], [longitude], [dbo].[address] ([latitude] between ( 52.488460 - 0.100000 ) , ( 52.488460 + 0.100000 )) , ([longitude] between ( -1.895690 - 0.100000 ) , ( -1.895690 + 0.100000 )) order [postcode] go executing query, couple of results. question stands difference (meters/miles) +/- 0.100000 lat/lon makes?
should try find close postcodes using first 3 letter of base postcode, i.e., 'b19'?
please see reference question full detail of scenerio.
thanks!
given approximate radius of earth being 6378.1 km.
latitude (and longitude, when along equator)
2 * pi * 6378.1 * 0.1 / 360 = 11.1319 km (4 d.p.) longitude when along x degrees north or south
for example, when @ 50 degrees north:
2 * pi * 6378.1 * cos(50) * 0.1 / 360 = 7.1554 km (4 d.p.)
Comments
Post a Comment