puritystandsout Posted July 13, 2006 Share Posted July 13, 2006 Besides having to pay a big subscription fee to the post office in the uk to search on post codes...I want to be able search on UK Cities and certain proximities like 50 mile radius...Does anyone have any idea how I'd go about this? Has anyone done this before?Please help. Thanks...Regards and Jesus Christ's blessings,Chris Cundill Quote Link to comment https://forums.phpfreaks.com/topic/14473-uk-cities/ Share on other sites More sharing options...
zq29 Posted July 13, 2006 Share Posted July 13, 2006 You can work it out from the cities grid references with a bit of Pythagoras. There are a number of databases about online with postcodes/references for free. Quick search on Google should help you out.[code]<?phpfunction distance($na,$ea,$nb,$eb) { $dist_n = $na - $nb; $dist_e = $ea - $eb; $hypot = sqrt(($dist_n * $dist_n) + ($dist_e * $dist_e)); return "Distance between $na(N) $ea(E) and $nb(N) $eb(E) is: ".round($hypot/1000,2)."kms";}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/14473-uk-cities/#findComment-57265 Share on other sites More sharing options...
Barand Posted July 13, 2006 Share Posted July 13, 2006 First you need a database of location, latitude, longitude.Once you know where all the places are you can find them with a search. Searching in a square centered on you location is easier than radial distances. So if the bottom left corner of the square is at x1, y1 and top right is at x2, y2 then you search forSELECT location WHERE long BETWEEN x1 and x2 AND lat BETWEEN y1 AND y2. Quote Link to comment https://forums.phpfreaks.com/topic/14473-uk-cities/#findComment-57268 Share on other sites More sharing options...
puritystandsout Posted July 14, 2006 Author Share Posted July 14, 2006 I'm getting somewhere I think...What Barand said made sense its just his sql statement is not quite what I need.Would someone be able to elaborate on this to help me understand how to actually return the distance between two points.Many Thanks.Regards and Jesus Christ's blessings,Chris Cundill Quote Link to comment https://forums.phpfreaks.com/topic/14473-uk-cities/#findComment-57877 Share on other sites More sharing options...
redarrow Posted July 14, 2006 Share Posted July 14, 2006 [quote]You can work it out from the cities grid references with a bit of Pythagoras. There are a number of databases about online with postcodes/references for free. Quick search on Google should help you out./[/quote]postcode database were please cheers.I googled and there all paid ones were can i get the postcode database free cheers. Quote Link to comment https://forums.phpfreaks.com/topic/14473-uk-cities/#findComment-57879 Share on other sites More sharing options...
brown2005 Posted July 14, 2006 Share Posted July 14, 2006 i dont know of any free scripts, but can i point out that uk postcodes are a trademark of royal mail and if people are found using them, u may get a hefty fine.. Quote Link to comment https://forums.phpfreaks.com/topic/14473-uk-cities/#findComment-57884 Share on other sites More sharing options...
redarrow Posted July 14, 2006 Share Posted July 14, 2006 So does that mean that company's and websites using the postcodes for gavering information for orders to pay are useing the royal mail post code service.nice to know cheers.So in reality there the ones offering the service to website users with a subcrition of some salt. Quote Link to comment https://forums.phpfreaks.com/topic/14473-uk-cities/#findComment-57889 Share on other sites More sharing options...
brown2005 Posted July 14, 2006 Share Posted July 14, 2006 well not really sure, i think it is only if you have a database of them, but i dont know, maybe u can use them for free, im just looking it up, see if i can come up with anything Quote Link to comment https://forums.phpfreaks.com/topic/14473-uk-cities/#findComment-57892 Share on other sites More sharing options...
redarrow Posted July 14, 2006 Share Posted July 14, 2006 cheers mate Quote Link to comment https://forums.phpfreaks.com/topic/14473-uk-cities/#findComment-57893 Share on other sites More sharing options...
Guest huey4657 Posted July 14, 2006 Share Posted July 14, 2006 I have a few links here - not sure if it is what you are loking for but here they are:-http://www.grcdi.nl/linkspc.htmhttp://www.evoxfacilities.co.uk/index.htmlhttp://en.wikipedia.org/wiki/List_of_postal_districts_in_the_United_Kingdomhttp://en.wikipedia.org/wiki/List_of_postal_areas_in_the_United_Kingdomhttp://en.wikipedia.org/wiki/Lists_of_postal_codes Quote Link to comment https://forums.phpfreaks.com/topic/14473-uk-cities/#findComment-57896 Share on other sites More sharing options...
redarrow Posted July 14, 2006 Share Posted July 14, 2006 Thank you for your help cheers i try them. Quote Link to comment https://forums.phpfreaks.com/topic/14473-uk-cities/#findComment-57901 Share on other sites More sharing options...
Barand Posted July 14, 2006 Share Posted July 14, 2006 Distance Calculationhttp://www.movable-type.co.uk/scripts/LatLong.html Quote Link to comment https://forums.phpfreaks.com/topic/14473-uk-cities/#findComment-57924 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.