Zip Code Radius Search

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bacci

    Zip Code Radius Search

    I'm creating a zip code radius search. I have a general understand of how
    this works, but am puzzled by how to get my final list of company locations.

    I have setup two database tables: one with zip codes w/latitudes and
    longitudes and the other with company names and addresses. The user enters
    their zip code and the corresponding latitude and longitude is returned. I
    then use this to return a list of zips, latitudes and longitudes within a
    given radius of the original zip.

    Using this list, how do I get my final list of company locations? I can loop
    through the list one by one, but is there a more efficient way?

    Thanks in advance!


  • Tom Thackrey

    #2
    Re: Zip Code Radius Search


    On 28-Jan-2004, "Bacci" <bacci@shimmi.c om> wrote:
    [color=blue]
    > I'm creating a zip code radius search. I have a general understand of how
    > this works, but am puzzled by how to get my final list of company
    > locations.
    >
    > I have setup two database tables: one with zip codes w/latitudes and
    > longitudes and the other with company names and addresses. The user enters
    > their zip code and the corresponding latitude and longitude is returned. I
    > then use this to return a list of zips, latitudes and longitudes within a
    > given radius of the original zip.
    >
    > Using this list, how do I get my final list of company locations? I can
    > loop
    > through the list one by one, but is there a more efficient way?[/color]

    Look up the users lat/long
    Join zip and company on zipcode, create a field that contains the distance
    from the users lat/long to the company's order by that distance (this can be
    done in one SELECT)

    --
    Tom Thackrey

    tom (at) creative (dash) light (dot) com
    do NOT send email to jamesbutler@wil lglen.net (it's reserved for spammers)

    Comment

    • Bacci

      #3
      Re: Zip Code Radius Search

      Tom,

      That should do it--thanks!

      I'm somewhat concerned about performance. That is, how long it will take to
      return a recordset again a database of over 52K records. Hopefully it won't
      be too bad.

      BTW, what's up with your signiture? Revenge? I'm thinking about doing the
      same for a "deserving" group.

      "Tom Thackrey" <use.signature@ nospam.com> wrote in message
      news:cV1Sb.1914 1$xw2.16338@new ssvr25.news.pro digy.com...[color=blue]
      >
      > On 28-Jan-2004, "Bacci" <bacci@shimmi.c om> wrote:
      >[color=green]
      > > I'm creating a zip code radius search. I have a general understand of[/color][/color]
      how[color=blue][color=green]
      > > this works, but am puzzled by how to get my final list of company
      > > locations.
      > >
      > > I have setup two database tables: one with zip codes w/latitudes and
      > > longitudes and the other with company names and addresses. The user[/color][/color]
      enters[color=blue][color=green]
      > > their zip code and the corresponding latitude and longitude is returned.[/color][/color]
      I[color=blue][color=green]
      > > then use this to return a list of zips, latitudes and longitudes within[/color][/color]
      a[color=blue][color=green]
      > > given radius of the original zip.
      > >
      > > Using this list, how do I get my final list of company locations? I can
      > > loop
      > > through the list one by one, but is there a more efficient way?[/color]
      >
      > Look up the users lat/long
      > Join zip and company on zipcode, create a field that contains the distance
      > from the users lat/long to the company's order by that distance (this can[/color]
      be[color=blue]
      > done in one SELECT)
      >
      > --
      > Tom Thackrey
      > www.creative-light.com
      > tom (at) creative (dash) light (dot) com
      > do NOT send email to jamesbutler@wil lglen.net (it's reserved for spammers)[/color]


      Comment

      • Bacci

        #4
        Re: Zip Code Radius Search

        Tom,

        That should do it--thanks!

        I'm somewhat concerned about performance. That is, how long it will take to
        return a recordset against a database of over 52K records. Hopefully it
        won't
        be too bad.

        BTW, what's up with your signiture? Revenge? I'm thinking about doing the
        same for a "deserving" group.

        "Tom Thackrey" <use.signature@ nospam.com> wrote in message
        news:cV1Sb.1914 1$xw2.16338@new ssvr25.news.pro digy.com...[color=blue]
        >
        > On 28-Jan-2004, "Bacci" <bacci@shimmi.c om> wrote:
        >[color=green]
        > > I'm creating a zip code radius search. I have a general understand of[/color][/color]
        how[color=blue][color=green]
        > > this works, but am puzzled by how to get my final list of company
        > > locations.
        > >
        > > I have setup two database tables: one with zip codes w/latitudes and
        > > longitudes and the other with company names and addresses. The user[/color][/color]
        enters[color=blue][color=green]
        > > their zip code and the corresponding latitude and longitude is returned.[/color][/color]
        I[color=blue][color=green]
        > > then use this to return a list of zips, latitudes and longitudes within[/color][/color]
        a[color=blue][color=green]
        > > given radius of the original zip.
        > >
        > > Using this list, how do I get my final list of company locations? I can
        > > loop
        > > through the list one by one, but is there a more efficient way?[/color]
        >
        > Look up the users lat/long
        > Join zip and company on zipcode, create a field that contains the distance
        > from the users lat/long to the company's order by that distance (this can[/color]
        be[color=blue]
        > done in one SELECT)
        >
        > --
        > Tom Thackrey
        > www.creative-light.com
        > tom (at) creative (dash) light (dot) com
        > do NOT send email to jamesbutler@wil lglen.net (it's reserved for spammers)[/color]


        Comment

        • Bacci

          #5
          Re: Zip Code Radius Search

          Tom,

          That should do it--thanks!

          I'm somewhat concerned about performance. That is, how long it will take to
          return a recordset against a database of over 52K records. Hopefully it
          won't be too bad.

          BTW, what's up with your signature? Revenge? I'm thinking about doing the
          same for a "deserving" recipient.

          "Tom Thackrey" <use.signature@ nospam.com> wrote in message
          news:cV1Sb.1914 1$xw2.16338@new ssvr25.news.pro digy.com...[color=blue]
          >
          > On 28-Jan-2004, "Bacci" <bacci@shimmi.c om> wrote:
          >[color=green]
          > > I'm creating a zip code radius search. I have a general understand of[/color][/color]
          how[color=blue][color=green]
          > > this works, but am puzzled by how to get my final list of company
          > > locations.
          > >
          > > I have setup two database tables: one with zip codes w/latitudes and
          > > longitudes and the other with company names and addresses. The user[/color][/color]
          enters[color=blue][color=green]
          > > their zip code and the corresponding latitude and longitude is returned.[/color][/color]
          I[color=blue][color=green]
          > > then use this to return a list of zips, latitudes and longitudes within[/color][/color]
          a[color=blue][color=green]
          > > given radius of the original zip.
          > >
          > > Using this list, how do I get my final list of company locations? I can
          > > loop
          > > through the list one by one, but is there a more efficient way?[/color]
          >
          > Look up the users lat/long
          > Join zip and company on zipcode, create a field that contains the distance
          > from the users lat/long to the company's order by that distance (this can[/color]
          be[color=blue]
          > done in one SELECT)
          >
          > --
          > Tom Thackrey
          > www.creative-light.com
          > tom (at) creative (dash) light (dot) com
          > do NOT send email to jamesbutler@wil lglen.net (it's reserved for spammers)[/color]


          Comment

          • R. Rajesh Jeba Anbiah

            #6
            Re: Zip Code Radius Search

            "Bacci" <bacci@shimmi.c om> wrote in message news:<V_0Sb.178 697$na.291973@a ttbi_s04>...[color=blue]
            > I'm creating a zip code radius search. I have a general understand of how
            > this works, but am puzzled by how to get my final list of company locations.
            >
            > I have setup two database tables: one with zip codes w/latitudes and
            > longitudes and the other with company names and addresses. The user enters
            > their zip code and the corresponding latitude and longitude is returned. I
            > then use this to return a list of zips, latitudes and longitudes within a
            > given radius of the original zip.
            >
            > Using this list, how do I get my final list of company locations? I can loop
            > through the list one by one, but is there a more efficient way?[/color]

            This is not the solution for your question. But, this is a good
            link on the topic <http://www.phparchitec t.com/sample.php?disc _show=316&mid=9 >

            --
            "I don't believe in the God who doesn't give me food, but shows me
            heaven!" -- Swami Vivekanandha
            Email: rrjanbiah-at-Y!com

            Comment

            • Tom Thackrey

              #7
              Re: Zip Code Radius Search



              On 29-Jan-2004, "Bacci" <bacci@shimmi.c om> wrote:

              [color=blue][color=green]
              > > Look up the users lat/long
              > > Join zip and company on zipcode, create a field that contains the
              > > distance
              > > from the users lat/long to the company's order by that distance (this
              > > can[/color]
              > be[color=green]
              > > done in one SELECT)[/color][/color]
              [color=blue]
              > I'm somewhat concerned about performance. That is, how long it will take
              > to
              > return a recordset again a database of over 52K records. Hopefully it
              > won't
              > be too bad.
              >
              > BTW, what's up with your signiture? Revenge? I'm thinking about doing the
              > same for a "deserving" group.[/color]

              It's just arithmetic, so I think performance will be OK. I've used it a bit,
              but not on a large table.

              James Butler was one of Walter Matthew's aliases in the movie Hopscotch. I
              use it as a honey pot for spammers, any email to that account goes directly
              to spamcop.



              --
              Tom Thackrey

              tom (at) creative (dash) light (dot) com
              do NOT send email to jamesbutler@wil lglen.net (it's reserved for spammers)

              Comment

              • Bacci

                #8
                Re: Zip Code Radius Search

                For performance reasons, I'm going to pre-calculate the high latitude and
                longitude.

                BTW, you and I have similar backgrounds and interests. I am web application
                developer by trade, but have been doing photography since high school. I was
                film based until finally converting to a digital about a year ago. I'd
                eventually like to get out of development all together and follow my bliss.
                Time will tell...

                "Tom Thackrey" <use.signature@ nospam.com> wrote in message
                news:29nSb.7667 $3p2.6372@newss vr29.news.prodi gy.com...[color=blue]
                >
                >
                > On 29-Jan-2004, "Bacci" <bacci@shimmi.c om> wrote:
                >
                >[color=green][color=darkred]
                > > > Look up the users lat/long
                > > > Join zip and company on zipcode, create a field that contains the
                > > > distance
                > > > from the users lat/long to the company's order by that distance (this
                > > > can[/color]
                > > be[color=darkred]
                > > > done in one SELECT)[/color][/color]
                >[color=green]
                > > I'm somewhat concerned about performance. That is, how long it will take
                > > to
                > > return a recordset again a database of over 52K records. Hopefully it
                > > won't
                > > be too bad.
                > >
                > > BTW, what's up with your signiture? Revenge? I'm thinking about doing[/color][/color]
                the[color=blue][color=green]
                > > same for a "deserving" group.[/color]
                >
                > It's just arithmetic, so I think performance will be OK. I've used it a[/color]
                bit,[color=blue]
                > but not on a large table.
                >
                > James Butler was one of Walter Matthew's aliases in the movie Hopscotch. I
                > use it as a honey pot for spammers, any email to that account goes[/color]
                directly[color=blue]
                > to spamcop.
                >
                >
                >
                > --
                > Tom Thackrey
                > www.creative-light.com
                > tom (at) creative (dash) light (dot) com
                > do NOT send email to jamesbutler@wil lglen.net (it's reserved for spammers)[/color]


                Comment

                • Tom Thackrey

                  #9
                  Re: Zip Code Radius Search


                  On 30-Jan-2004, "Bacci" <bacci@shimmi.c om> wrote:
                  [color=blue]
                  > For performance reasons, I'm going to pre-calculate the high latitude and
                  > longitude.[/color]

                  I suppose you could compute a square around the target zip and select those
                  zips that fall within the square the companies that are in those zips.
                  [color=blue]
                  >
                  > BTW, you and I have similar backgrounds and interests. I am web
                  > application
                  > developer by trade, but have been doing photography since high school. I
                  > was
                  > film based until finally converting to a digital about a year ago. I'd
                  > eventually like to get out of development all together and follow my
                  > bliss.
                  > Time will tell...[/color]

                  I've been dragged kicking and screaming into digital. I now do very little
                  color film. I still do all my black and white in the darkroom, but I've
                  friends who are scanning B&W, photoshoping it and inkjet printing new negs.
                  Most of them are platinum printing, but I can see the advantages for hard to
                  print negs.



                  --
                  Tom Thackrey

                  tom (at) creative (dash) light (dot) com
                  do NOT send email to jamesbutler@wil lglen.net (it's reserved for spammers)

                  Comment

                  Working...