Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A listener was added to “listen” to clicks on the map, and when clicked, a new marker is added with a sequential alphabet label. Another listener was added to listen to clicks on existing markers, which then shows the info window for that marker.

...

The mapLabelling module works together with geolocation to receive and display locations. From the geolocation module, a final list of all latitude and longitude coordinates are accumulated in a list. Once all the coordinates are appended to the list, the list is then written to a .txt file in the format shown below:

...

This .txt file is then accessed by the HTML file that displays the JavaScript Google map API. After the HTML file reads in the text file, it first splits the latitude and longitude coordinates by new line, “\n” to create an array. In this array, each index represents one coordinate, for example, [43.47036890733803,-80.5362815379075]. Then, the array is split again at commas, “,” to create a list of lists. In this example, the list contains 21 elements, and each element contains another two elements (latitude and longitude). Each coordinate in the array is parsed into a float, and two floats (one coordinate) is made into an object. Now, this array of objects were either used to loop through and create markers, or they were drawn on the map as a polyline. Properties of the polyline were set, such as the colour, opacity, and weight, and the flight path was set to the map. This simply connects each sequential coordinate from head to tail using a red line and displays the red line on the map.

...