Welcome Guest, Not a member yet? Register   Sign In
Search by Zip Code and Distance
#2

Most people would do this via a map api like google maps.

Alternatively you could have a table of all postcodes and their lattitudes and longitudes and do some maths to calculate the max and min lattitudes and longitudes and select all postcodes within those ranges. This is quite complicated though, especially as here in the uk postcodes can be very strange shapes indeed. Simplified if you just use a square of side length = chosen distance, put the chosen postcode as the center and select all postcodes that those ranges include.

Either way, it would probably be better to use an api and rely on much bigger, better maintained map data than do it yourself. Then you could offer to search by city perhaps, or by driving time etc. Amazing what you can do with map api's these days.
Reply


Messages In This Thread
Search by Zip Code and Distance - by tom756 - 05-11-2017, 10:38 AM
RE: Search by Zip Code and Distance - by PaulD - 05-11-2017, 10:59 AM
RE: Search by Zip Code and Distance - by tom756 - 05-12-2017, 01:02 PM
RE: Search by Zip Code and Distance - by skunkbad - 05-12-2017, 01:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB