Quantcast
Channel: Topic Tag: zip | WordPress.org
Viewing all articles
Browse latest Browse all 1073

Tijmen Smit on "[Plugin: WP Store Locator] Sort results by distance from zip"

$
0
0

As a store owner wouldn't you want your store to show first if your zip was typed in? And is there a way to make sure this happens.

As I said before this is how it should work.

It shows the distance in the search results right? They are not ordered by distance? Maybe the problem is this, when you search for a zip code it uses the coordinates from the center of that zip. This is the starting point for the calculation to determine which store is falls within the range.

Maybe what you visually on the map expect to be the center of a zip isn't the center according to Google Maps. That would explain why it looks like it doesn't return the nearest result first.

If you search for the 90210 zip it returns this, look for geometry -> locations https://maps.googleapis.com/maps/api/geocode/json?address=90210&sensor=false&region=us

Search with those values on Google maps ( 34.1030032, -118.4104684 ) and you can see where the center is https://www.google.nl/maps/place/34%C2%B006%2710.8%22N+118%C2%B024%2737.7%22W/@34.0984857,-118.4177962,14z/data=!4m2!3m1!1s0x0:0x0?hl=en

Replace 90210 with the zip you searched for in this URL https://maps.googleapis.com/maps/api/geocode/json?address=90210&sensor=false&region=us, and then grab the values under geometry -> locations and search for them on Google Maps. The marker is probably not where you expect it to be?

I assume you haven't made any customizations to the code? What is your url, and what is the zip you search for?


Viewing all articles
Browse latest Browse all 1073

Trending Articles