There may be a way to do this with a Google Maps mashup (meaning do it in the browser using JavaScript), but I haven’t done it personally. The last time I had to do this, I used a Ruby on Rails plug-in called Geocoder, which queried a free server in Canada for the Zip-to-geolocation stuff, then showed a list of matching locations ranked by distance from the starting Zip code. This only helps you if you have a Rails application there, or want to build one. Google offers a similar service, but theirs isn’t free when you use it in a commercial application like this. Here’s lots of info about it, including a list of compatible data providers and their costs: GitHub - alexreisner/geocoder: Complete Ruby geocoding solution.
I also did a test page way back in Freeway 2 using a MySQL database of Zip codes I bought from a (naggingly persistent) vendor and some MySQL Trigonometry code I found on Google. It’s called a Great Circle calculation, and it figures out the distance from the center of one Zip code to another. Trouble is, depending on the density of your region, this may be wildly inaccurate. Imagine somewhere in Montana, where there are more cattle than people. There, a Zip code may cover many many square miles, while in Manhattan, it may cover a few blocks. (The goal of a Zip code is to map a certain number of addressable locations to a single post office that presumably will deliver to them.) The issue becomes whether the location of your store is near the center of the (often weirdly-shaped) Zip code region or near one of the edges. And if the originating point isn’t near the center of its Zip code, you may send someone to a location that makes no sense at all, even if the numbers tell you that it should be the closest to them. I don’t have this code ready to hand, but once my file server gets replaced next week, I should be able to find it and post it somewhere visible.
This is a fun experiment, but it’s not something I’ve seen solved in a ready-to-use, no-code-needed manner. If anyone else knows of a way to do this that doesn’t require my propeller-beanie, please pipe up!
Walter
On Feb 9, 2014, at 1:43 PM, Jay wrote:
Hi, has anybody got any thoughts on how I would produce a search facility for ‘find your nearest store’ in freeway - my client has 7 stores and if I could do this on there site I would be over the moon.
Again thanks for your input
Jay
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options