A programming challenge?

Discussion in 'OT Technology' started by Astro, Jul 20, 2003.

  1. Astro

    Astro Code Monkey

    Joined:
    Mar 18, 2000
    Messages:
    2,047
    Likes Received:
    0
    Location:
    Cleveland Ohio
  2. eof

    eof New Member

    Joined:
    Jan 17, 2002
    Messages:
    7,288
    Likes Received:
    0
    Depends how hard it is to figure out where a zip code is...if the data is easy to find then finding a lat / longitude on a map and placing a marker isn't hard.
     
  3. Astro

    Astro Code Monkey

    Joined:
    Mar 18, 2000
    Messages:
    2,047
    Likes Received:
    0
    Location:
    Cleveland Ohio
    All talk... Put it in action!
     
  4. CyberBullets

    CyberBullets I reach to the sky, and call out your name. If I c

    Joined:
    Nov 13, 2001
    Messages:
    11,865
    Likes Received:
    0
    Location:
    BC, Canada/Stockholm, Sweden
    how are american zip codes setup? :dunno: random?
     
  5. Penguin Man

    Penguin Man Protect Your Digital Liberties

    Joined:
    Apr 27, 2002
    Messages:
    21,696
    Likes Received:
    0
    Location:
    Edmonton, AB
    What are we supposed to do, put it on the map, or just get a location from the zip code?
     
  6. Astro

    Astro Code Monkey

    Joined:
    Mar 18, 2000
    Messages:
    2,047
    Likes Received:
    0
    Location:
    Cleveland Ohio
    In the end, take the zip code and place it on the map. Accuracy doesn't need to be dead on, but close enough.
     
  7. eof

    eof New Member

    Joined:
    Jan 17, 2002
    Messages:
    7,288
    Likes Received:
    0

    It isn't hard to put a point anywhere on a map...the difficult part is finding a data source with all the zip codes and their corresponding latitude / longitudes. Do you know of such a data source? If not then give up.....

    I won't bother with this because I am not american and couldn't give less of a fuck where you homo's live....
     
  8. Astro

    Astro Code Monkey

    Joined:
    Mar 18, 2000
    Messages:
    2,047
    Likes Received:
    0
    Location:
    Cleveland Ohio
    eof: dude, I didn't ask for you to post here. If this is too complex for you, don't kill yourself thinking about it.

    Yes, I have the zip codes. Yes, I have the lat/long for each zip. The part I'm working on right now is figuring out the scale of the graphic and anchoring the lat/long values to it.
     
  9. Leb_CRX

    Leb_CRX OT's resident terrorist

    Joined:
    Apr 22, 2001
    Messages:
    39,994
    Likes Received:
    0
    Location:
    Ottawa, Canada
    hmm interesting...very very interesting, I might be interested in participating, let me see when I get home
     
  10. eof

    eof New Member

    Joined:
    Jan 17, 2002
    Messages:
    7,288
    Likes Received:
    0

    :dunno:

    You asked "How far out of reach do you guys think this is?" I told you it is not hard to do if you have the know the locations of the zip codes. You get pissy cause I was the only one that replied to your thread origionaly and you fire up the "All talk... Put it in action!".

    :rolleyes:

    So in fact you did ask me to post in here indirectly... :fawk:
     
  11. Astro

    Astro Code Monkey

    Joined:
    Mar 18, 2000
    Messages:
    2,047
    Likes Received:
    0
    Location:
    Cleveland Ohio
    Problem is finding an equation that takes into account earth's curved surface and how that relates to latitudes (they get closer to each other as you get closer to the equator).
     
  12. Slimmy

    Slimmy Get Richt or Die Trying

    Joined:
    Mar 14, 2000
    Messages:
    135,671
    Likes Received:
    29
    Location:
    Ft. Lauderdale
  13. Astro

    Astro Code Monkey

    Joined:
    Mar 18, 2000
    Messages:
    2,047
    Likes Received:
    0
    Location:
    Cleveland Ohio
    This site explains some of the logic and math behind map projection:

    http://www.mentorsoftwareinc.com/cc/gistips/TIPSarch.HTM

    Below is a link to a very cool map, which in its raw form, would be very functional, but the map itself is a 220mb+ TIF image. There's a ton of data for this map in terms of what the specs are for one pixel and the lat/long start position is:

    http://nationalatlas.gov/shadedm.html

    Down towards the bottom of this page:

    http://www.npm.ac.uk/rsdas/doc/description.html

    Has some interesting algorithms:

    I think the problem I'm running into is this algorithm works, but doesn't fit the map I'm using (I'm thinking this algorithm would work for the map found at the .gov link I just listed up above).

    So far I've got code that is somewhat accurate within Ohio. Trick is the farther out you go, the further off it gets...
     
  14. Astro

    Astro Code Monkey

    Joined:
    Mar 18, 2000
    Messages:
    2,047
    Likes Received:
    0
    Location:
    Cleveland Ohio
    Yup, I was using the wrong map. Give this a whirl:

    http://www.rsbauer.com/usa/zipfind.php

    Because this is a different map projection, the algorithm to calculate the longitude and latitude to x and y was much easier. I also found some of the code from the NetGeo project helpful (where I found the image at). The NetGeo project takes your IP and attempts to map your location.

    To revisit the original purpose of this, I'd think the image would have to be sliced and diced a bit to zoom in on the USA.

    If folks are interested in seeing the code and collecting the data, let me know and I'll find a home for it on my site...
     
  15. CompiledMonkey

    CompiledMonkey New Member

    Joined:
    Oct 26, 2001
    Messages:
    8,528
    Likes Received:
    0
    Location:
    Richmond, VA
    Good job Astro, mine came up really well. :big grin:
     
  16. Astro

    Astro Code Monkey

    Joined:
    Mar 18, 2000
    Messages:
    2,047
    Likes Received:
    0
    Location:
    Cleveland Ohio
    For those wondering about the data, I found the link to where I got mine:

    http://www.census.gov/geo/www/gazetteer/places2k.html

    Its from the 2000 census. Look for the link "ZCTAs (ZIP Code Tabulation Areas)" (5mb download). This will give you zip code to latitude/longitude, but keep in mind, the zip codes used by the census for some odd reason are not geographically the same as the ones used by the post office (if you look at some maps, they end up being pretty close).

    On that page you'll find some other nifty tid bits of information. I'd love to see the zip code associated with the city, but it doesn't look like there's a clean way of doing it from their data (its possible another gov't site has this data).
     
  17. Astro

    Astro Code Monkey

    Joined:
    Mar 18, 2000
    Messages:
    2,047
    Likes Received:
    0
    Location:
    Cleveland Ohio
    Ok - I'm easily amused:

    http://www.axtime.com/zip/zipfind_oh.php?EventID=70

    I've got a site setup to manage autocross pre-registration. The above link is the population spread who came to our event yesterday (well, give or take - its pre-reg so there some no shows and pre-reg tends to make up only 1/3 of all those who attend).

    I don't have the event location highlighted (I'll save that for another day), but if you're curious, look in Summit county (its in northeast Ohio) and the 2nd most southern dot in Summit is about where this event was held.
     

Share This Page