Created
September 28, 2016 07:34
-
-
Save MicheleBertoli/b89695c63f2598347f2c2e9e28d0ad24 to your computer and use it in GitHub Desktop.
Polyline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { Gmaps } from 'react-gmaps'; | |
const App = React.createClass({ | |
onMapCreated(map) { | |
const flightPlanCoordinates = [ | |
{ lat: 37.772, lng: -122.214 }, | |
{ lat: 21.291, lng: -157.821 }, | |
{ lat: -18.142, lng: 178.431 }, | |
{ lat: -27.467, lng: 153.027 }, | |
]; | |
const flightPath = new google.maps.Polyline({ | |
path: flightPlanCoordinates, | |
geodesic: true, | |
strokeColor: '#FF0000', | |
strokeOpacity: 1.0, | |
strokeWeight: 2, | |
}); | |
flightPath.setMap(map); | |
}, | |
render() { | |
return ( | |
<Gmaps | |
height={300} | |
lat={37.772} | |
lng={-122.214} | |
onMapCreated={this.onMapCreated} | |
width={400} | |
zoom={1} | |
/> | |
); | |
}, | |
}); | |
ReactDOM.render(<App />, document.getElementById('gmaps')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment