7

Is there any tool or method in order to convert Google Map route, direction into array of lat/lon coordinates? What I am trying to do is to simulate NMEA sentences in order to test my application.

5

*** UPDATED FOR 2020 GOOGLE MAPS UI ***

I found this video extremely helpful, the first part of it concerns your question. It shows you how you can plot a route on a map and then export it.

Steps:

  • Sign into your google account/If you don't have one then you will need to create one to do it this way

  • Go to google maps (https://maps.google.com/)

  • Click on "My Places", then on the "Maps" tab click "Create Map"

  • From the toolbar under the search bar click on "Draw a line" and choose the type of route

  • Find the area you want on the map, click once to set starting point.

  • Draw the route you want, and then double click to set ending point. (you can use single click to fix points within your route if it goes round weird corners and the path moves)

  • When you are happy with your route click on the 3 dots to the right of the map's name and select "Export to KML/KMZ"

  • Change the option "Entire map" to just the route you have selected and "Download" as KML

  • Open the KML file in your favorite text editor (e.g. Notepad++) and find the < coordinates > tag (the one inside the < LineString > tag if there is more than one) which will contain all the coordinates of your route

2
  • 1
    Can you please summarize the video? If the video is taken down, then your answer loses its value
    – Sathyajith Bhat
    Mar 19 '15 at 9:22
  • 1
    Needs updating for the latest maps UI, but a very helpful answer.
    – Chucky
    Feb 13 '17 at 16:54
1

You can play with the Google Maps API, or, if you're just interested in quickly finding the coordinates of the waypoints on a Google Map route, you can generate a .gpx file (in either Garmin or "generic" format) using this tool

http://www.cgtk.co.uk/navigation/gpx

The resulting .gpx file has the data you need, in decimal degrees of lat & long. According to the instructions, Google's free API limits to 10 waypoints. Note that I don't have affiliation with A. S. Buden (http://www.cgtk.co.uk/)

0

You can use directionsService.route result to fetch each step's coordinates. For example.

var request = {

    origin: start_point,

    destination: end_point,

    travelMode: 'DRIVING'

  };

  directionsService.route(request, function(result, status) {

    if (status == 'OK') {

      directionsRenderer.setDirections(result);

      var directionsData = result.routes[0].legs[0];

      var steps = [];

      for (var i = 0; i < directionsData.steps.length; i++) {

        steps[i]['lat'] =  directionsData.steps[i].start_point.lat();

        steps[i]['lng'] = directionsData.steps[i].start_point.lng());
      
       }

    }
  });

You can change this as per your used technology.

0

I think this app will help you a lot.

https://play.google.com/store/apps/details?id=geo.location.tracker.and.editor

enter image description here

This is a tool to track your routes and you can export it as GEO JSON file. You can customize the distance between every two points. Click on the start tracking button and you have to move on your route. (walking, driving, etc.) There is a feature on this app that edits your tracked list. So you can remove or edit tracked coordinates. You can import external GEO JSON files and edit that JSONs as well. You can find more on the app's help section Simple description - https://www.youtube.com/watch?v=JyBTYD0wgiU.

enter image description here

enter image description here

1
  • Welcome to Web Applications! This answer would be better if you provide a brief description. Also, keep in mind not everybody owns an Android device ...
    – Glorfindel
    Jul 30 '20 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.