Active
Project:
Get Directions
Version:
6.x-2.4
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
20 Feb 2012 at 05:20 UTC
Updated:
23 Feb 2012 at 00:14 UTC
Hi,
How can calculate distance between node to current login user.
some body help me.
Thanks.
Ravi Kumawat
Comments
Comment #1
hutch commentedAssuming that both the node and the user are location enabled, you can use Getdirections to provide you with a map by using a path like this:
where 'nnn' is the node ID and 'uuu' is the user ID
This will show the total distance if you have enabled that in configuration.
The distance is the distance by road and is calculated by the javascript that fetched the map from Google using the route information provided.
Getdirections does not provide a way of collecting the distance from Google without using a map.
You might be able to write your own javascript that does, see Directions Service for the details on how to use Google API v3
Comment #2
ravi.khetri commentedThanks for this.
But how can get distance between node and user in code(custom modules).
please help me.
Comment #3
hutch commentedThere are functions in the Getlocations module, see getlocations/modules/getlocations_fields/getlocations_fields.functions.inc, there are functions in there to calculate the distance between two points, eg function getlocations_fields_earth_distance()
You will need to supply the latitude/longitude of each point in decimal degrees.
Comment #4
ravi.khetri commentedThanks .
i am using Drupal 6 and this is not avilable in this.
Comment #5
hutch commentedYou should be able to use the functions, renamed of course in your custom module.
Comment #6
ravi.khetri commentedbut i not get getlocations_fields in drupal 6.
please help me with example.
Comment #7
hutch commentedI think you need a php programmer to help you, I have given you all the information you need, the code is there for you to copy and use....