Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7621977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:20:06+00:00 2026-05-31T04:20:06+00:00

I had to repair an old project regarding google maps so this is in

  • 0

I had to repair an old project regarding google maps so this is in V2. In my database, I already had the latlng of all the user in my database. Then there are certain events that the system can create (e.g. a fire event). Now, the system should be able to compute the distance of all the users from the fire event and list down all the people based on their distance from the area. How can I do that? fromAddress should be an array of the people’s latlng and toaddress is the latlng of the event. The logic must be similar to the code below

for(i=0;i<fromAddress.length;i++){
    gdir.load("from: " + fromAddress[i] + " to: " + toAddress,  { "locale": "en" });
    distance = Math.round((gdir.getDistance().meters / 1000)*10)/10;
    duration = Math.round(gdir.getDuration().seconds/60);
    //store distance and duration for output
}

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:20:07+00:00Added an answer on May 31, 2026 at 4:20 am

    There are different options:

    1. When the distance doesn’t have to be based on a route, you don’t need any requests, you may calculate the distance using google.maps.geometry.spherical.computeDistanceBetween()
      In v2 use distanceFrom
    2. request a directionResult for every origin/destination-pair
      (V2: getDistance())
    3. request a DistanceMatrixResult , it allows you to retrieve up to 25 results with 1 request
      (This is not available in V2, but you may request the web-service: http://code.google.com/intl/en/apis/maps/documentation/distancematrix/ )
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Had no luck getting this to work via what I found on google.
Had a quick google to see if this can be done without much luck,
Had another thread regarding this but it wasn't resolved probably because I wasn't very
I recently ran the database repair tool as per this link: http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/db-repair-tool At the
Had finally gotten all the bugs out of this and now they said Oh,
After phone repair I lost all the applications and had to re-arrange Applications screens
Had this working; at one stage. The problem is the following text is now
Had a search around and can't seem to find any options to do this,
Had a nice PHP/HTML/JS prototype working on my personal Linode, then tried to throw
Had this: $(function(){ $(a.next.down).click(function() { $(ul.panel li).addClass(upOne); $(a.next).removeClass(down).addClass(downTwo); }); $(a.next.downTwo).click(function() { $(ul.panel li).addClass(upTwo); $(a.next).removeClass(downTwo).addClass(downThree);

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.