Professional Web Applications Themes

Geographic Search Results - Coldfusion - Advanced Techniques

A client organization has a search utility on their site, which allows the publis to search for members of the organization by zip code, among other criteria. The client has asked about being able to show the results sorted by distance away from the "target zip code." I see this frequently for finding a store in a chain, for example, but have no idea what additional data would be required to make it work. For example, if I say my zip code is nnnnn, how do I sort out all the similar zip codes by distance away from nnnnn? Will ...

  1. #1

    Default Geographic Search Results

    A client organization has a search utility on their site, which allows the
    publis to search for members of the organization by zip code, among other
    criteria. The client has asked about being able to show the results sorted by
    distance away from the "target zip code." I see this frequently for finding a
    store in a chain, for example, but have no idea what additional data would be
    required to make it work.

    For example, if I say my zip code is nnnnn, how do I sort out all the similar
    zip codes by distance away from nnnnn? Will this result be substantially
    different from just matching the first 3 digits of the zip code, other than the
    sorting?

    My gut tells me a need quite a bit more data to do this, but don't really have
    a clue where to start. There are over 65000 members in this organization, so
    getting more detailed geographic data for each of them, beyond the full
    address, is not a trivial exercise. Can anyone who has done this type of search
    help me out with some basic information?

    tempestweb Guest

  2. #2

    Default Re: Geographic Search Results

    tempestweb wrote: 

    you'll need geographic coordinates for the center of each zipcode that
    you'll deal with. search around there are plenty of databases free or
    otherwise. then you'll need to calculate the distance from zipcode to
    zipcode, the code for that has been published dozens of times, check the
    gallery or cflib.
     

    if you're talking about geocoding (ie you have accurate street addresses
    & you want geographic location, etc.) then you might look at one of the
    webservices like esri.com's arcweb to handle this (as well as routing,
    etc.).

    have a look at:
    http://www.sustainablegis.com/projects/geocode/flashforms/
    http://www.sustainablegis.com/projects/routing/
    PaulH Guest

  3. #3

    Default Re: Geographic Search Results

    The geocoding is more detail than I need right now. I'll look for the zip code/lat./long. databases. Thank you.
    tempestweb Guest

  4. #4

    Default Re: Geographic Search Results

    Be careful of converting lats and longs to actual distances. That curvature
    of the earth is really pesky at times.

    Originally posted by: tempestweb
    The geocoding is more detail than I need right now. I'll look for the zip
    code/lat./long. databases. Thank you.



    Dan Guest

  5. #5

    Default Re: Geographic Search Results

    And how.

    Check
    http://groups.google.com/group/comp.databases.ms-access/browse_thread/thread/9d4
    259ec7a8b491c/ccb130aa11c6fde2?lnk=st&q=latitude+longitude+dista nce+function&rnu
    m=2&hl=en#ccb130aa11c6fde2 for a nice discussion of arc distances and a VB
    solution that should be translatable to CF or the DB language of your choice.

    (And, as a former ESRI person, thanks for the ArcPlug. Jack Dangermond will
    appreciate it.)

    philh Guest

  6. #6

    Default Re: Geographic Search Results

    philh wrote: 

    considering we're looking at zipcode centroid to zipcode centroid,
    unless you want alaska to florida (which by the sound of the original
    post isn't the case) i don't think this is going to matter much. in fact
    if the resultset didn't need to be sorted by distance i'd just suggest a
    simple bounding box query as good enough.

    btw i'd do the distance calculation in the db (if it has the math to
    handle it).
     

    oh everybody knows we're an esri shop through & through ;-)

    ps: see all the hoopla over autodesk & mapserver?

    PaulH Guest

  7. #7

    Default Re: Geographic Search Results

    I think we're just talking about a maximum of 20 miles here, not a great circle
    route, so the curvature/projection distortion shouldn't really come into play.
    (I never really thought my Coast Guard coastal navigation course would come
    into play with my day job. Life is full of surprises...)

    There's also a discussion of the calculations at
    http://zips.sourceforge.net/

    The db is MS SQL, but I'm still a bit concerned about the amount of
    calculation that will have to be done if the search returns a couple of hundred
    results.

    tempestweb Guest

  8. #8

    Default Re: Geographic Search Results

    tempestweb wrote: 

    i've used sql server for this, it's not that bad. if you want, run a
    bounding box search first to get the rows roughly within your radius
    search, then do the calculations.

    PaulH Guest

Similar Threads

  1. Search results
    By Bskyweb in forum Coldfusion Database Access
    Replies: 3
    Last Post: July 16th, 07:52 PM
  2. Sending search results to a results page..with asp
    By dan.how in forum Dreamweaver AppDev
    Replies: 1
    Last Post: May 26th, 04:18 PM
  3. Help with search results in asp vbs
    By Chris in forum Dreamweaver AppDev
    Replies: 2
    Last Post: February 17th, 09:57 PM
  4. Search Results
    By Rosemary_Thommen@adobeforums.com in forum Adobe Acrobat Windows
    Replies: 2
    Last Post: June 21st, 12:31 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139