Search code examples
geolocationfoursquarezipcodesimplegeo

Does SimpleGeo provide ZIP code to latitude/longitude mapping?


I'm working with SimpleGeo API and I need to get place's latitude/longitude by ZIP code or city name. I know there is a plenty of questions in SO about getting coordinates by ZIP code, and there are many nice databases for it. But are they something that correlates closely with SimpleGeo's data? I don't want, having a precise city name/ZIP code that exists in SimpleGeo's database, to get to nowhere just because my database differs from SG's one.

Alternatively, I can move completely to Foursquare API, if it provides such data, but this is less preferable.

So, my questions are:

  1. Can I get latitude/longitude by ZIP code or city name through SimpleGeo (or at least Foursquare)?
  2. If not, can I use other databases (e.g. MaxMind or Geonames) to get same results? Should I care about differences between databases at all?

Solution

  • Yes, you can use the SimpleGeo Context APIs to do this. Call the SimpleGeo context endpoint with the city name or zip code as the address parameter like this: http://api.simplegeo.com/1.0/context/address.json?address=98006

    The response has the latitude and longitude embedded in the "query" part of the JSON blob returned:
    { "query":{ "latitude":40.745717, "longitude":-73.988121 ... }, ... }

    Hope this helps.

    Thanks,
    -Nikhil