SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist barbara1712's Avatar
    Join Date
    Apr 2007
    Location
    India
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to get the nearest zip code

    Hello Guys,

    I am new to php.
    I want that if I provide the zip code, I want the nearest 5 zip code around the specified zip code.
    Is there any way to find the nearest zip codes of specified postal code in php?

    Please help me.

    Your help will be highly appriciated.

    Thanks.
    Barbara

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    First you need a database that maps zip codes to latitudes/longitudes. Then it's just a database query which orders by the length of a line segment between two points with latitude/longitude as coordinates.

  3. #3
    SitePoint Evangelist barbara1712's Avatar
    Join Date
    Apr 2007
    Location
    India
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Dan Grossman,

    I will try to do it.

    Thanks again.
    Barbara

  4. #4
    SitePoint Member
    Join Date
    Apr 2009
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.zipcodeworld.com/developers.htm

    Check out the above link. They have some sample codes in PHP to calculate the distance between two ZIP codes but you will need a database of latitudes and longitudes for the ZIP codes.


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
  •