SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict Shaydez's Avatar
    Join Date
    Jul 2006
    Location
    Boca Raton, Florida
    Posts
    356
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    ZipCode Radius of Given ZipCode?

    I downloaded a DB of Zipcodes with Latitude and Longitude.

    I want to know if its possible to get a list of zipcodes within a radius of a given zipcode.

    For example i type
    33433 and i should get 10miles of zipcodes

    33487
    33431
    33483 etc

    would i need to use API for this or can i do it specifically in my database?
    Sr. Website Developer and Internet Marketing
    www.CarlosJa.com Note: If anyone
    needs to get ahold of me please feel free to email me through
    my site. Apparently i missed quite a few private messages.

  2. #2
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,179
    Mentioned
    65 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by Shaydez View Post
    I downloaded a DB of Zipcodes with Latitude and Longitude.

    I want to know if its possible to get a list of zipcodes within a radius of a given zipcode.

    For example i type
    33433 and i should get 10miles of zipcodes

    33487
    33431
    33483 etc

    would i need to use API for this or can i do it specifically in my database?
    http://snipplr.com/view/2531/

    This would have to be run against the entire db each time you want to calculate it, can be costly.
    Another option if you feel like using MongoDB: http://docs.mongodb.org/manual/core/geospatial-indexes/

    There are zip code dbs that should have long / lat with it.

  3. #3
    SitePoint Addict Shaydez's Avatar
    Join Date
    Jul 2006
    Location
    Boca Raton, Florida
    Posts
    356
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Posting this for other to find --

    Found this class.. Works like freakn charm..
    https://github.com/Quixotix/PHP-ZipCode-Class

    Results it spits out
    Get the distance between 2 zip codes
    Zip code 33431 is 14.02 miles away from zip code 33309
    Zip code 33431 is 1726.47 kilometers away from the city Boca Raton
    Zip code 33431 is 17.36 miles away from the city Fort Lauderdale

    Get all zip codes between 10 and 15 miles from 97214
    Zip code 33436 is 10.4 miles away from 33431 (Palm Beach county)
    Zip code 33435 is 10.5 miles away from 33431 (Palm Beach county)
    Zip code 33076 is 10.8 miles away from 33431 (Broward county)
    Sr. Website Developer and Internet Marketing
    www.CarlosJa.com Note: If anyone
    needs to get ahold of me please feel free to email me through
    my site. Apparently i missed quite a few private messages.

  4. #4
    SitePoint Member
    Join Date
    May 2013
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    zip code radius source codes

    Here you can find the sources codes for the zip code radius calculation not only in PHP but also in ASP.NET (C#) and Coldfusion: http://www.zipcodesoft.com/zip-codes-in-a-radius
    An interesting add-on could be to calculate the distance as the road distance instead of as the crow flies.
    This page shows how to to that: http://www.zipcodesoft.com/distance-between-zip-codes
    The necessary zip code database you can download here: http://www.zipcodesoft.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •