Creating polylines

Use the polyline component to create a new polyline.

{{#g-map lat="51.507568" lng="-0.127762" zoom=10 styles=primaryMapStyle as |g|}}
  {{g.polyline path=arrayOfCoordinates
    geodesic=true
    strokeColor="orange"
    strokeOpacity=1.0
    strokeWeight=3}}
{{/g-map}}

Test Click on the map to append new points to the polyline!

Observing changes to the path

Polylines are slightly special because the path attribute is an array, which can't be watched for changes by didReceiveAttrs – the hook this addon uses to avoid creating hundreds of observers.

To combat this issue, the addon defines the _watchedOptions concatenated array. The polygon component populates it with the path.[] key, which is used to dynamically create an observer.

Let's learn how to add info windows or tooltips to the map.

Info windows ›