Skip to content
Justin Kimbrell edited this page Aug 20, 2014 · 1 revision

Overview

If you need to add a polyline to template without using the field type you should use the craft.googleMaps.polyline() method. The first argument must be a map id, the second is the polyline coordinates, and the third argument is an object of parameters. All the default parameters are supported by the Google Maps API.

Example

{% set options = {
	id: 'map', 
	width: '400px', 
	height: '300px',
	center: 'The Florida Keys',
	options: {
		disableDoubleClickZoom: true,
		maxZoom: 10
	}
} %}

{{ craft.googleMaps.map(options) }}

{% set points = [
	[0, 0],
	[0, 10],
	[10, 10],
	[10, 0]
] %}

{{ craft.googleMaps.polyline('map', points, {strokeColor: 'red'}) }}