################################################## # Map title is the text in the tab on whatever browser map_title = pudfile # This gets the coordinates from the above function gps_markers = get_coordinates(pudfile + '.csv') # We need a clone of gps_markers because python assigns by reference. # In short it means if you change the copy you'll ALSO change the original. Not good. # On top of that gps_markers is a 2D list so it requires a bit more thought. new_gps = [sublist[:] for sublist in gps_markers] # Use said copy to do something different without effecting the original. plots = make_points(new_gps) # Get header info in the form of a string that we can then send as a message to the webpage alert = get_header_info(pudfile) # Here we generate the html page by passing the above # information to the relevant files example_map = simplemap.Map(map_title, markers=gps_markers, points=plots, message=alert) # We also need a name for the html file that's being outputted example_map.write(pudfile + '.html') # Finally we finish the script by opening the html # file with whatever is the defult browser webbrowser.open_new(pudfile + '.html') # Give some indication that the process has finished and now we just open the html file. print '\nWriting ' + pudfile + '.hmtl...'
import simplemap map_title = 'Example Map' center_point = [34.5124, -118.1111] #center_point = None gps_markers = [ ['Example text', 34.4563,-118.1241], [34.6432,-118.1554] ] example_map = simplemap.Map(map_title, markers=gps_markers) example_map.write('example.html')
# On top of that gps_markers is a 2D list so it requires a bit more thought. new_gps = [sublist[:] for sublist in gps_markers] # Due to there being so many waypoints generated from the dat file it's easier to only keep # the first and last waypoint and then identify which is which with hover text. # The rest of the flight will just be a line of where the drone went. gps_markers[0].insert(0, 'Start') gps_markers[-1].insert(0, 'End') gps_markers = [ gps_markers[0], gps_markers[-1] ] # Use said copy to do something different without effecting the original. plots = make_points(new_gps) # Get header info in the form of a string that we can then send as a message to the webpage #alert = get_header_info(pudfile) # Here we generate the html page by passing the above # information to the relevant files example_map = simplemap.Map(map_title, markers=gps_markers, points=plots) # We also need a name for the html file that's being outputted example_map.write(csvfile + '.html') # Finally we finish the script by opening the html # file with whatever is the defult browser webbrowser.open_new(csvfile + '.html') # Give some indication that the process has finished and now we just open the html file. print '\nWriting ' + csvfile + '.hmtl...'