0

I am trying to make a google map using Javascript. I want to use a .csv file to plot the latitudes and logitudes. When I hardcode the values I get the points but I am not sure how to plot them using the .csv file. My .csv file contains over 76000 coordinates.

    <!DOCTYPE html>
    <html>
    <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <title>Simple Polylines</title>
    <style>
    /* Always set the map height explicitly to define the size of the div
    * element that contains the map. */
    #map {
    height: 100%;
    }
    /* Optional: Makes the sample page fill the window. */
    html, body {
    height: 100%;
    margin: 0;
    padding: 0;
   }
   </style>
   </head>
   <body>
   <div id="map"></div>
   <script>


   function initMap() {
    var map = new google.maps.Map(document.getElementById('map'), {
      zoom: 10,
      center: {lat: 29.766083, lng: -95.358810},
      mapTypeId: 'terrain'
    });

    var flightPlanCoordinates = [
      {lat: 29.718922, lng: -95.339162},
      {lat: 29.71683047, lng: -95.40166506},
      {lat: 29.748425, lng: -95.677353},
      {lat: 29.739545, lng: -95.462716}
    ];
    var flightPath = new google.maps.Polyline({
      path: flightPlanCoordinates,
      geodesic: true,
      strokeColor: '#FF0000',
      strokeOpacity: 1.0,
      strokeWeight: 2
    });

    flightPath.setMap(map);
   }
  </script>
  <script async defer
  src="https://maps.googleapis.com/maps/api/js?
  key=AIzaSyAbeZY_drCHzHUoWYl6EMgMdZsJxaVt3pk&callback=initMap">
  </script>
  </body>
  </html>



   [enter image description here][1]


  [1]: https://i.stack.imgur.com/dU38w.png

0 Answers0