Adding flight paths to Maps

Overlaying polyLines to make flight paths on google markers get it now

This article will cover how to add flight paths to Google Maps. For a quickstart, see Step by Step Guides

Try it out first ?

If you just want a to try it, then you can download an example application (googleMapping.xlsm) and come back here later. First you should take a look at Adding markers to Google Maps from ExcelQuicklinks and Categories and Overlaying circles and heatmaps since this is just an enhancement of that.

What are flightPaths

These are lines joining a seried of points on a map. You can have multiple flightPaths on a map, specified by the parameter flightGroup as defined below.

How to specify points to be joined

This is accomplished through data specifiying a flightGroup in your data record. The geoCoding parameter sheet defines the column name in which to find the flightGroup. A flightGroup can be named anything you want. Markers with the same flightGroup name will be connected by a  line. In this case I happen to be using the same data column as I used for Quicklinks and Categories but you can add a sepcific column if you want to.

How to specify flightPath colors

Just as in Overlaying circles and heatmaps the color to use is picked up from a data column associated with the flightColor parameter. Note that in this case I am using the same color for both the circle and the flightPath. Since it is conceivable that multiple colors will appear for data items in the same flightGroup, then the color of the last item in the flightPath is used for all tems the flightGroup. If no flightColor is given, but a flightGroup is specified thens ome suitable default will be used. 

As in the other mapping examples, javaScript procedures are created based on the Excel data, which are then executed to create a map. Adding flightPaths is simply building on what has been already covered in Adding markers to Google Maps from Excel

Here is an example

Based on this data

Changing the properties of the flightPath

By default, the flightPath properties are

                new google.maps.Polyline({
                       path: flightCoords,
                        strokeColor: color,
                        strokeOpacity: 1.0,
                        strokeWeight: 2 ,
                    map: gMap

Changing these is just a matter of editing the above, which is in the functions row of the marker html parameter block in the geoCodingParamers worksheet.

Why not join our forum,follow the blog or follow me on twitter to ensure you get updates when they are available, or read more about Charts and color ramps, or Overlaying circles and heatmaps or take a look at Step by Step Guides

You want to learn Google Apps Script?


Google Apps Script for Developers and Google Apps Script for Beginners.