See geometry library documentation for decodePath
This will convert your encoded string into an array of google.maps.LatLng objects that can be used to create Polyline
Working example
snippet of working code:
function initialize() { var myLatLng = new google.maps.LatLng(24.886436490787712, -70.2685546875); var mapOptions = { zoom: 13, center: myLatLng, mapTypeId: google.maps.MapTypeId.TERRAIN }; var bermudaTriangle; var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
html, body { height: 100%; margin: 0; padding: 0; } #map_canvas { height: 100%; } @media print { html, body { height: auto; } #map_canvas { height: 650px; } }
<script src="https://maps.googleapis.com/maps/api/js?libraries=geometry"></script> <div id="map_canvas"></div>
source share