-
-
Save tiago-peres/40701a7b7b205d101a4f7ce01ad9d785 to your computer and use it in GitHub Desktop.
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
<html> | |
<head> | |
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" /> | |
<script defer src="https://pyscript.net/latest/pyscript.js"></script> | |
</head> | |
<h1>Some places I have visited over the years:</h1> | |
<div id="folium"></div> | |
<body> | |
<py-config> | |
packages = ["folium"] | |
[[fetch]] | |
from = "https://gist.githubusercontent.com/bbelderbos/37823bf81b85f2916f384afa27950a6d/raw/7d060275a0ce7ad60cef5a09555d529ce8d2cb08/" | |
files = ["places.py"] | |
[[fetch]] | |
from = "https://raw.githubusercontent.com/pybites/100DaysOfCode/master/050/" | |
files = ["simplemaps-worldcities-basic.csv"] | |
</py-config> | |
<py-script> | |
import folium | |
from places import get_cities_lon_and_lats | |
city_coords = get_cities_lon_and_lats("simplemaps-worldcities-basic.csv") | |
center_city = "Berlin" | |
map = folium.Map(location=city_coords[center_city], zoom_start=4, | |
tiles='Stamen Terrain') | |
for city, coords in city_coords.items(): | |
folium.Marker(coords, popup=city).add_to(map) | |
display(map, target="folium") | |
</py-script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From: https://www.linkedin.com/posts/bbelderbos_python-projects-frontendwebdevelopment-activity-7016327304322662400-KcpV