i new gmaps4 , have tried lot not able find how create geodesic map, if have single source , multiple destination using gmap4 rails.
so far have tried
js
var locations = [ //starting point "home", , links other locations"// ['home', 37.774930, -122.419416], ['location-1', 35.689487, 139.691706], ['location-2', 48.856614, 2.352222], ['location-3', -33.867487, 151.206990] ] function initmap() { var mylatlng = { lat: 12.363, lng: -131.044 }; var map = new google.maps.map(document.getelementbyid('map'), { zoom: 3, maptypeid: google.maps.maptypeid.roadmap, center: { lat: 0, lng: 0 } }); var markers = []; var bounds = new google.maps.latlngbounds(); // add markers , infowindows map (var = 0; < locations.length; i++) { var marker = new google.maps.marker({ position: new google.maps.latlng(locations[i][1], locations[i][2]), title: locations[i][0], map: map }) markers.push(marker); bounds.extend(marker.getposition()); if (i > 0) { var sitepath = new google.maps.polyline({ path: [markers[0].getposition(), marker.getposition()], geodesic: true, strokecolor: '#ff0000', strokeopacity: 1.0, strokeweight: 2, map: map }); } } map.fitbounds(bounds); } google.maps.event.adddomlistener(window, "load", initmap);
html
<div id="map"></div>
but not able understand how using gmaps4 rails
Comments
Post a Comment