Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Calculate road distance between two cities

  • Dan2000
  • Dan2000's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
11 years 7 months ago #84856 by Dan2000
Hi,
Has anyone managed to setup a survey that calculates road distances between two towns ?
Ideally, the user would insert in two text fields the name of the cities and then "it" would calculate the distance.
I am looking into using the google maps api and a HTML/PHP script, but if anyone has had a limesurvey experience with this...

Grateful for any ideas

Cheers !
Daniel
The topic has been locked.
More
11 years 7 months ago - 11 years 7 months ago #84859 by floccs
Replied by floccs on topic Calculate road distance between two cities
You can use google maps apis to do that without any PHP.

e.g.
maps.googleapis.com/maps/api/distancemat...driving&sensor=false

this request returns a JSON containing the distance driving from Milan to Rome ( here all the documentation).

You can use also latitude and longitude instead of city names (those returned by a map question)
Last edit: 11 years 7 months ago by floccs.
The topic has been locked.
  • Dan2000
  • Dan2000's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
11 years 7 months ago #84868 by Dan2000
Replied by Dan2000 on topic Calculate road distance between two cities
Hi, thanks for your reply.
How would it be possible to integrate the google API into a lime survey?
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
11 years 7 months ago #84879 by Mazi
Limesurvey already uses the Google Maps API for the Maps question type. You should be able to add some Javascript at the survey to read the lat./long. values for the two town and then calculate the distance and store the value at another question.

Will be quite tricky though but should be doable.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
More
7 years 4 months ago #144031 by david80
Replied by david80 on topic Calculate road distance between two cities
Now calculate the distance between any cities of England and the world will be able to
a special calculator that will help every person calculate
any route through several intermediate cities, you will be able to
specify only those cities through which you want to drive - you can specify up to 10 intermediate cities
Use the website for calculating the distance - distancecalculation.info
and you can always find out the exact distance between any two cities in the world.

Also, calculate the distance calculator will calculate how many liters of fuel you spend on route
and its price, estimated travel time, know the exact distance in both kilometers and miles in a straight line
and by road, if you do not like the route that the system itself has chosen for you, you can select
an alternative route, and calculate the distance calculator can take into account your own speed limit
driving on the road, simply select the speed of your movement on the roads, and the calculator will calculate the route according to your
speed drive mode.

The calculator is able to calculate a route only on free roads, which means
that in this mode, the route will be laid exclusively on free roads
avoiding toll stations - it can save your money, calculator can also avoid ferries
in this case, the route will begin only on roads where there is no ferry

Calculator calculates the distance!
In a straight line - the calculation of distance is a straight line.
On the roads - the calculation of the distance is on the road.
Walking - the calculation of the distance is on public roads and sidewalks.
Cycling - the distance calculation is carried out on public roads and cycle paths.

You will be able to visually see any route that you created on the world map
well below the map, you can get detailed instructions from the road all the signs where needed and where to turn
and so on it is very convenient.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose