Created
September 22, 2016 18:36
-
-
Save tapanojum/81460dd89cb079296fee0c48a3d625a7 to your computer and use it in GitHub Desktop.
Plotting GPS coords
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 folium | |
import pandas as pd | |
# Pulls CSV file from this location and adds headers to the columns | |
df = pd.read_csv('Example.CSV',names=['Longitude', 'Latitude',]) | |
lat = (df.Latitude / 10 ** 7) # Converting Lat/Lon into decimal degrees | |
lon = (df.Longitude / 10 ** 7) | |
zoom_start = 17 # Zoom level and starting location when map is opened | |
mapa = folium.Map(location=[lat[1], lon[1]], zoom_start=zoom_start) | |
i = 0 | |
j = (lat[i] - lat[i - 1]) | |
location = [] | |
while i < len(lat): | |
if abs(j) < 0.01: | |
location.append((lat[i], lon[i])) | |
i += 1 | |
else: | |
break | |
# Line plot settings | |
c1 = folium.MultiPolyLine(locations=[location], color='blue', weight=1.5, opacity=0.5) | |
c1.add_to(mapa) | |
mapa.save(outfile="Example.html") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment