SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 40
  1. #1
    SitePoint Member
    Join Date
    Sep 2002
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Zipe Code Locator

    I am looking for a zipcode locator function. I want to be able to search my database of locations between x mile radius of xxxxx zipcode. Does anyone know where i can find this?

    Thanks
    Neil
    Keep It Real

  2. #2
    Xbox why have you forsaken me? moospot's Avatar
    Join Date
    Feb 2001
    Location
    Clearwater, FL
    Posts
    3,615
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    SitePoint Member
    Join Date
    Sep 2002
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    been there, seen that, im looking for a free result. Or a free database. I have done some research and im sure i will be able to calculate the distances if i had the latitude and longitude of zipcodes. Simple Trig

    Neil
    Keep It Real

  4. #4
    Xbox why have you forsaken me? moospot's Avatar
    Join Date
    Feb 2001
    Location
    Clearwater, FL
    Posts
    3,615
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "simple" trig LOL

    I will keep a look out for a free zip code database

  5. #5
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    Svj
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is want you want to build?
    1. User enters zip code
    2. Your database returns the position (x,y) of that zip code (in the middle of that area, I guess)
    3. Add R miles to that position
    4. Get all other zip codes with position within the radius R from (x,y)
    (5. Get some other interesting information, e.g. companies having those zip codes)

    I don't think you will find a free database

    If you visit US Postal Services, you will find "The information you are seeking is not available via download but is provided through the National Customer Support Center at (800) 238-3150"

    Other countries may give away the zip code info for free, for example the Faroe Islands

    Reflection:
    I think you should convert the Latitude/Longitude to a position in the US National Grid System, because the distance between two longitudes isn't the same on all latitudes
    How to read USNG
    National Geodetic Survey

  6. #6
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    Svj
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And the distance between two latitudes isn't always the same ...

    http://www.rovaniemi.fi/lapinkavijat...index_eng.html
    "His aim was by measuring a degree of latitude along a line of longitude to investigate whether the earth was flattened at its poles."

    And yes, of course I have been to the monument on the top of the Kittisvaara fell in Pello

  7. #7
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Not only that but Zip Codes in the United States are not setup for a set area. They are based on Population density. Not only that where I live, we have one main post office which handles 4 different zip codes. One of those zipcodes is limited to post office boxes within the building.

    To do what you want to do is a lot more than simple trig.
    Wayne Luke
    ------------


  8. #8
    Hi there! Owen's Avatar
    Join Date
    Jan 2000
    Location
    CA
    Posts
    1,165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The Melissa software can do that (I believe) but it's certainly not free.

    Owen

  9. #9
    SitePoint Member
    Join Date
    Sep 2002
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes i know, it doesn't have to be exact.

    Thanks for all your help

    Neil Conlan
    Keep It Real

  10. #10
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    Svj
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by W. Luke
    Not only that but Zip Codes in the United States are not setup for a set area. They are based on Population density. ...
    Yes, that was my reflection number two that I forgot in my previous answer; zip codes are related to areas of different size, and somewhere (Alaska?) there must be a zip code very difficult to associate with a specific position

    Isn't a map where the user can select a city a better idea? (And latitude & longitude for a city is easier to find)

  11. #11
    SitePoint Evangelist jkh1978's Avatar
    Join Date
    May 2001
    Location
    Northern Virginia
    Posts
    445
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think I may have what you need... Im working on finishing a similar database. What exactly do you need? I want to give back to this community who has been very helpful to me in the past.

  12. #12
    SitePoint Enthusiast
    Join Date
    Jul 1999
    Location
    Jacksonville, FL
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What you are looking for can be found here. Data is from 1990 Census (that's what you get when the price is $0):

    http://spatialnews.geocomm.com/newsl.../zipcodes.html

    Scroll down to US Census. It's a zip file containing a comma separated values file (saved oddly as .txt). You'll need to import it into your DB, then do the math.

    If you want to buy an updated database, I've seen it as low at $40. Google is your friend.

    Let me know if you need help with the math -- I've got some VBScript lying around here somewhere that'll do the trick and if you use a different lang. -- no prob, the concept translates.

    Have fun!
    Shawn

  13. #13
    SitePoint Guru marcel's Avatar
    Join Date
    Nov 2000
    Posts
    920
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    phpclasses.org has some classes, code and sample data on how to do this.

    visit phpclasses.org - search for zip
    see what you find

    m00

  14. #14
    SitePoint Evangelist jkh1978's Avatar
    Join Date
    May 2001
    Location
    Northern Virginia
    Posts
    445
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Couldnt find the code on phpclass.org, but since I already wrote the code myself its cool.

    On another note, how does that site highlight a row in a table when i mouseover that row?

  15. #15
    SitePoint Wizard
    Join Date
    Oct 2001
    Posts
    2,686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by jkh1978
    On another note, how does that site highlight a row in a table when i mouseover that row?
    http://www.sitepointforums.com/showt...threadid=59665

    http://www.sitepointforum.com/showth...threadid=50826

    Hope this is what you're looking for?

    -Helge

  16. #16
    SitePoint Enthusiast Dontom's Avatar
    Join Date
    Mar 2001
    Location
    Germany
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i guess this will help you:

    http://www.cryptnet.net/fsp/zipdy/

    from the website:
    Zipdy is a program for calculating the distance between two zip codes and finding all the records in a RDBMS with a zip code with x miles of another zip code. Currently, RDBMS support exists for postgreSQL. Additional future support for other databases will be added in future releases of zipdy.

    Zipdy is free software released under the terms of the GNU General Public License. Zipdy was written in C but is also available in PHP and perl. It runs with data from the US Census Gazetteer program. The original Gazetteer data is available here. The data is from the 2000 census.

    The distance calculations are made by doing a great circle calculation on longitude and latitude points provided by the census data. The result is returned in standard miles. If you need an explanation of what a great circle distance calculation is, click here.
    hope this helps you,
    Tom

  17. #17
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Moved to a more appropriate forum

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  18. #18
    SitePoint Enthusiast
    Join Date
    Jul 1999
    Location
    Jacksonville, FL
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Seanf -- not sure where you moved this, but I got a question regarding how to calculate zipcodes ranges given latitude and longitude and I think it will be helpful here if anyone should search the forum for it:
    Quote Originally Posted by jsk137
    Shawn,

    You posted in a thread about zipcodes that you might have some code for doing proximity searches against a zipcode database.

    I have the zipcode database with lon and lat.

    I am working on the code now. It is for a dealer locator script where the user will enter a zip code and range of miles and the script will return a listing of dealers in that mileage range. I am coding in Php.

    Anything you can throw my way will be appreciated.

    Thanks,
    Jeff
    Jeff,

    I did mine in VBScript for an ASP application, but a couple minutes on Google (php zip radius) produced the following -- which is exactly what I found for ASP:


    PHP Builder

    and

    dbforums

    They both have good explanations. Here's my (rough) VBScript version fwiw (I'm leaving out declaring variables and actual sql):
    Code:
    'FIRST FIND THE LAT AND LON FOR THE ZIPCODE
    'SUBMITTED BY THE USER
    
    'SQL GOES HERE
    
    ' THIS VARIABLE SETS THE RADIUS IN MILES
    'iRadius = 30
    LatRange = iRadius / ((6076 / 5280) * 60)
    LongRange = iRadius / (((cos(cdbl(istartlat * 3.141592653589 / 180)) * 6076.) / 5280.) * 60)
    LowLatitude = istartlat - LatRange
    HighLatitude = istartlat + LatRange
    LowLongitude = istartlong - LongRange
    HighLongitude = istartlong + LongRange
    
    'USE HIGH AND LOW LAT AND LON TO SELECT ZIP CODES
    'THAT FALL IN THOSE RANGES
    
    'SQL - select zip where lat <= lowlat and late <= highlat and
    long >= lowlong and long <= highlong
    Let me know if that doesn't make sense or if I can clarify.

  19. #19
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    Svj
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just curious; that formula is based on the approximation that the earth is a sphere (not flattened)?
    I mean, if I want to calculate something near the zip code for Santa Claus at the north pole, the formula will give me an (a bit) incorrect result?

    2nd: The numbers (6076 / 5280) * 60 ? Are they supposed to be equal to 24900 / 360 (the length of 1&#176; in miles) ?

  20. #20
    Sidewalking anode's Avatar
    Join Date
    Mar 2001
    Location
    Philadelphia, US
    Posts
    2,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    TuitionFree a free library for the self-taught
    Anode Says... Blogging For Your Pleasure

  21. #21
    SitePoint Enthusiast
    Join Date
    Jul 1999
    Location
    Jacksonville, FL
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jofa
    Just curious; that formula is based on the approximation that the earth is a sphere (not flattened)?
    I mean, if I want to calculate something near the zip code for Santa Claus at the north pole, the formula will give me an (a bit) incorrect result?

    2nd: The numbers (6076 / 5280) * 60 ? Are they supposed to be equal to 24900 / 360 (the length of 1 in miles) ?
    1. Exactly -- this formula will not give a precise measurement. As I understand it, the old school way of getting lat and lon for the zip was based on the location of the post office -- inherently inaccurate. I haven't figured out Zip Code Tabulation Areas (ZCTA's) b/c I only needed this for a reference application. Also, it wasn't necessary to have precise measurement of pt. to pt. distances.

    2. Yes again.

    I know there are more accurate ways of doing this, but if you just need a yardstick, this is as good as any. I'd love to see this done with the new ZCTA's and such.

  22. #22
    SitePoint Enthusiast
    Join Date
    Jul 1999
    Location
    Jacksonville, FL
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by anode
    Phat... now all we need is an open source implementation!

  23. #23
    SitePoint Enthusiast
    Join Date
    Jul 1999
    Location
    Jacksonville, FL
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wanted to follow up on this thread b/c I've figured out ZCTA's for a new project I'm working on. Thank the Census Bureau again for this gem.

    Zip, Lattitude and Longitude in handy ascii format:
    http://www.census.gov/geo/www/gazetteer/places2k.html

    There are four files available. The one you'll be interested in is the ZCTA file.

    "The ZCTA file contains data for all 5 digit ZCTAs in the 50 states, District of Columbia and Puerto Rico as of Census 2000. The file is plain ASCII text, one line per record."

    Unfortunately, the ZCTA file doesn't have city/town/village names, just zip codes, lat, lon. AND, the schmucks didn't include the FIPS code so you can't import the places and zcta files into tables and join them to get the city/town/village name. Still, it's way more up-to-date than the 1990 data I reference above -- and, again, the price is right.

    Enjoy!

  24. #24
    SitePoint Enthusiast Everah's Avatar
    Join Date
    Mar 2004
    Location
    East Bay Area, CA, USA
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ZIP Code data

    I know this thread hasn't been touched upon for a while but I have a few files that contain all the zip codes (with city names and states) in the US (AK and HI included). I also have a piece of PHP code that creates a MySQL table with zip codes and LATS & LONGS. Is that what was being sought?

  25. #25
    chown linux:users\ /world Hartmann's Avatar
    Join Date
    Aug 2000
    Location
    Houston, TX, USA
    Posts
    6,455
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Everah
    I know this thread hasn't been touched upon for a while but I have a few files that contain all the zip codes (with city names and states) in the US (AK and HI included). I also have a piece of PHP code that creates a MySQL table with zip codes and LATS & LONGS. Is that what was being sought?
    Yes, I believe that is exactly what they are looking for.


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
  •