Google Maps X mile radius form a point

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CpVermont
    New Member
    • Feb 2008
    • 14

    Google Maps X mile radius form a point

    Good morning,
    I didn't see a forum for Google Maps so I figured this would be the best place to post. My question has more to do with geocoding than JS, but I will be using JS to perform the search and the calculations. First of all I want to convert miles to lat lng. Say my Lat is 43.5643 what would be the Lat's 5 miles in either direction.

    Here's what I'm working on. I have an XML file with all the lat's and lng's (Geopts) of locations. I'm trying to allow a user to perform a search for locations within a selected distance from an address, zip, or city/state. I've already set up all the framework to verify the address and geocode it. In order to save calls to Google Maps Client Geocoder I want to perform all the caculations without using distanceFrom(). For my pourposes a bounding box is fine. We don't need to refine it to an actual circle. I know there is probably a framework already setup for this, but I want to actually learn it myself. So your help will be greatly appreciated.

    Thank you,
    CpVermont
  • hsriat
    Recognized Expert Top Contributor
    • Jan 2008
    • 1653

    #2
    Originally posted by CpVermont
    First of all I want to convert miles to lat lng. Say my Lat is 43.5643 what would be the Lat's 5 miles in either direction.
    One latitude is approx 69 Miles (found on google).

    And there is no uniform conversion of longitudes into miles. Distance between longitudes is maximum at equator and 0 at poles.

    But I know one thing that it takes 4 minute for Sun to move from one longitude to the next.

    So at a particular latitude, you can find distance between longitudes by dividing the latitudinal circumference of that latitude with (24*60/4).

    milesInOneLongi tude = latitudinalCirc umference / (24*60/4)


    Harpreet

    Comment

    • CpVermont
      New Member
      • Feb 2008
      • 14

      #3
      Originally posted by hsriat
      One latitude is approx 69 Miles (found on google).

      And there is no uniform conversion of longitudes into miles. Distance between longitudes is maximum at equator and 0 at poles.

      But I know one thing that it takes 4 minute for Sun to move from one longitude to the next.

      So at a particular latitude, you can find distance between longitudes by dividing the latitudinal circumference of that latitude with (24*60/4).

      milesInOneLongi tude = latitudinalCirc umference / (24*60/4)


      Harpreet
      First of all I want to thank Harpreet for taking the time to check up on this for me. After reading the replies I was able to do some more research into this. I checked out google maps api and found out that the distanceFrom() function does not use google's geocoder. So I plan on using a loop to loop through all the Geopts and a filter to exclude the ones that are obviously too far and then use google's distanceFrom() to get the exact matches. So again Thank You Harpreet.

      Comment

      Working...