Skip to content

Instantly share code, notes, and snippets.

@keremistan
Created June 11, 2018 19:17
Show Gist options
  • Save keremistan/a955f0f99ec35bf03f9e77459214e7e9 to your computer and use it in GitHub Desktop.
Save keremistan/a955f0f99ec35bf03f9e77459214e7e9 to your computer and use it in GitHub Desktop.
Using folium, create a map and mark the given coordinates
import folium
# map function gets location, zoom and tiles
berlin = folium.Map(location=[52.49, 13.36])
# geo_locations.txt file is where the coordinates are. For example: Mitte,52.5295114,13.384034
file = open("/Users/kerem/Desktop/geo_locations.txt", "r")
content = file.read().split('\n')
coords_of_addresses = []
for con in content:
splitted = con.split(',')
if splitted.__len__() == 3:
lat = con.split(',')[1]
lon = con.split(',')[2]
coords_of_addresses.append((lat, lon))
star_marker = folium.Marker((float(lat), float(lon)) , popup='That"s the marker!!!', icon=folium.Icon(icon='star', color='blue'))
star_marker.add_to(berlin)
berlin.save("/users/kerem/Desktop/htm.html")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment