Use Google Maps to Create Route Shapefile

Datetime:2016-08-23 05:22:15          Topic:          Share

In this post I am going to go over in detail how to save a route generated using Google Maps as a shapefile so you can use it in any GIS software. In the summer of 2016 I embarked on a road trip from Southern Ontario to British Columbia and I wanted to make some fun maps of my travels. I didn’t just go the fastest route but had a lot of interesting stops along the way so I wanted to capture them in my maps. To get the routes as shapefiles to use in my map creation I decided to use Google My Maps. Once I had generated the directions I also needed a way to export them.

In order to create a shapefile of a route generated in Google Maps I actually had to use My Maps from Google. It is not exactly the same as Google Maps, but there are a lot of similarities and it has the same routing capabilities. To get to My Maps go to https://www.google.com/mymaps you will need to have a Google account to log in and save any maps you create. Google My Maps is web browser GIS service that enables users to create custom maps with points, lines, and shapes on top of Google Maps, using a WYSIWYG editor. For this tutorial I will be using it to get directions.

Creating a Google My Maps

Once you have loaded My Maps click on ‘Create A New Map’.

In the new map first change the map name so you can recognize it later. Just double click where it says ‘Untitled map’. The next thing I did was rename the ‘Untitled layer’ so that I could add all of my points of interest to it. This way you can keep track of the places you are getting directions to and from.

Now you can start searching for locations. Just type in the place you are looking for into the search bar. Then it should come up as a green point marker. Click on the point marker and select ‘+ Add to map’.

One thing I noticed is once you have multiple layers in your map (each set of directions adds a new layer to the map) you need to make sure that layer is selected before pressing ‘+ Add to map’. If you do not select the layer it will not be added where you are expecting it to go. To select the layer just click on the point layer you created on the left. Once you click on the layer it will have a blue bar next to it.

Now that you have added the point to your Google My Maps you can now start searching for directions. Click on the point you added, and select the directions icon (looks like a road on ramp with an arrow). This will add a direction layer to your map.

In the direction layer it will pop up a search dialogue for the start location to get to the destination point you just clicked on. Enter the place you came from and it will add the directions layer to the map.

After you have added the first routing layer it becomes important to make sure you are adding your point locations to the right layer. Now just go through and add as many routes as you need. There is a limit of 10 layers per Google My Map, so it is a little limiting if you are trying to show lots of little stops and details.

In this tutorial I added a new layer for each set of routing, however you could just keep adding all of the destinations into a single routing layer. You can keep adding a new destination by clicking ‘Add Destination’ in the navigation layer on the contents pane. After you have added all of the directions you want (or can add) you are ready to export your map to a KML. KML stands for Keyhole Markup Language, and it is a geographic data format based on XML and is easily compatible with web browsers and software like Google Earth and ArcGIS Earth. We will be using the KML and converting it to a Shapefile.

Export Google My Maps to KML

To export your map click the ellipses at the top right of the contents pane and select ‘Export to KML’.

It will load up a dialogue with some options. I exported to a KML losing the custom icons which is fine for my purposes.

Converting the KML to a Shapefile in ArcGIS Pro

Now that we have a KML file we want to convert it to a shapefile. There are a lot of ways to do this and I decided to use ArcGIS Pro. I created a new project in ArcGIS Pro then added a new map layer. Under the Analysis Pane select Tools. Then in the Geoprocessing dialog search for KML. Select the ‘KML To Layer’ tool and a dialogue will show up.

In the dialogue you just have to select the KML file that you just saved and set the output name.

If you kept most of the default settings it will output the KML to a geodatabase. In the Project Pane navigate to Folders>Your Project>The KML output name>Placemarks>… Then you can select the points or polylines file created from the KML. A KML file can store both points and polylines, however they are separated in a geodatabase.

In this tutorial we went through using Google My Maps to create routing directions. The directions were then exported to a KML which will work in software like Google Earth or ArcGIS Earth. We then converted the KML to a shapefile using ArcGIS Pro (there are many ways to accomplish this). This gave us a shapefile with our points of interests and routing polylines for use in any GIS software.