Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. import React from 'react';
  2. import ReactDOM from 'react-dom';
  3. import { Gmaps } from 'react-gmaps';
  4.  
  5. const App = React.createClass({
  6.  
  7. onMapCreated(map) {
  8. const flightPlanCoordinates = [
  9. { lat: 37.772, lng: -122.214 },
  10. { lat: 21.291, lng: -157.821 },
  11. { lat: -18.142, lng: 178.431 },
  12. { lat: -27.467, lng: 153.027 },
  13. ];
  14.  
  15. const flightPath = new google.maps.Polyline({
  16. path: flightPlanCoordinates,
  17. geodesic: true,
  18. strokeColor: '#FF0000',
  19. strokeOpacity: 1.0,
  20. strokeWeight: 2,
  21. });
  22.  
  23. flightPath.setMap(map);
  24. },
  25.  
  26. render() {
  27. return (
  28. <Gmaps
  29. height={300}
  30. lat={37.772}
  31. lng={-122.214}
  32. onMapCreated={this.onMapCreated}
  33. width={400}
  34. zoom={1}
  35. />
  36. );
  37. },
  38.  
  39. });
  40.  
  41. ReactDOM.render(<App />, document.getElementById('gmaps'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement