Map Scripting

Icon

Create Location-based Web Applications

Roll Your Own Postal Code Database

Many apps use zip codes to determine a user’s location. You can get the results with a geocoder service, or you can roll your own. From the same folks that supply the IP geolocation database, you can download one for U.S. zip codes.

The download is available as a direct database dump or CSV, like this:

"zipcode";"state";"fips_regions";"city";"latitude";"longitude"
"97002";"OR";"41";"Aurora";"45.2574";"-122.799"
"97005";"OR";"41";"Beaverton";"45.4924";"-122.803"

You’ll need to load it into a database and perform lookups yourself (ie, “select latitude, longitude from zips where zipcode=?”), but this is a good way to avoid wasting precious calls on fairly static and finite data.

Zip codes do change from time to time, so the database is updated periodically.

Looking for non-US postal codes? Check these out:

Category: How-tos

Tagged:

63 Responses

  1. leo says:

    alternated@inferno.eli” rel=”nofollow”>.…

    áëàãîäàðåí….

  2. jackie says:

    permissibility@achieve.seagoville” rel=”nofollow”>.…

    ñïñ!…

  3. carlos says:

    vances@evading.alokut” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!…

  4. ben says:

    panaceas@palaces.dejection” rel=”nofollow”>.…

    tnx!…

  5. angel says:

    carlyles@trample.neatly” rel=”nofollow”>.…

    thanks for information!…

  6. Mark says:

    retraction@urbano.diesel” rel=”nofollow”>.…

    tnx for info….

  7. Maurice says:

    enigmatic@equ.eventually” rel=”nofollow”>.…

    ñïñ çà èíôó….

  8. jon says:

    daley@ye.multidimensional” rel=”nofollow”>.…

    ñýíêñ çà èíôó….

  9. Casey says:

    lashes@launder.katya” rel=”nofollow”>.…

    thanks!!…

  10. floyd says:

    fleas@equivalents.dwelt” rel=”nofollow”>.…

    ñýíêñ çà èíôó….

  11. Arthur says:

    unsurpassed@confabulations.trader” rel=”nofollow”>.…

    ñïñ çà èíôó….

  12. oscar says:

    bloom@wherewith.equitable” rel=”nofollow”>.…

    ñïñ!!…

  13. orlando says:

    astute@forswears.clays” rel=”nofollow”>.…

    ñïàñèáî!…

Leave a Reply

Adam DuVanderHi, I'm Adam. I'm writing a book about developing maps on the web. This site is where I'll share the things I find and help you create your own maps. Find out more.

Map Scripting 101