We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Location and entries by distance - getting a ton of NAN

Seth Giammanco November 25, 2014 by Seth Giammanco

Working on a critical project that includes a search by zip code. We are using google get the lat/long for the zip and then passing that to an entries tag for a location driven statamic entry list using distance of entries from the zip shared.

The "gist" of the solution is working however we are getting wonky results. Most notably we are getting many, many cases where some entries get a distance value and others are getting "NAN".

  • We have tried two services (first mapquest then Google) to geocode the posted zip and both gave comparable results.
  • We have tried different mapping services to see if that would have an impact, no change.

Question? what service is being used to calculate the distances? If not the same as the mapping service credentials in the config, what is it and are there other options?

EDIT - dug into the code further to see Mapquest is being used for this

Any other ideas as I have to get a working solution going ASAP and may need to scrap a Statamic powered solution.

>>>>>>> Unanswered <<<<<<<
1 Reply
1 Follower