Skip to content

Instantly share code, notes, and snippets.

@doabell
Created October 9, 2024 01:52
Show Gist options
  • Save doabell/73d7853e82be1e4cb6adb6c6f97f15cb to your computer and use it in GitHub Desktop.
Save doabell/73d7853e82be1e4cb6adb6c6f97f15cb to your computer and use it in GitHub Desktop.
Original DC boundaries
# GPT-4o-mini via duck.ai
import folium
# Create a map centered around the midpoint of the provided coordinates
# Tiles: https://python-visualization.github.io/folium/latest/user_guide/raster_layers/tiles.html
m = folium.Map(
location=[38.895, -77.040],
zoom_start=11,
tiles="Cartodb dark_matter",
)
# Define the coordinates for the corners of the DC square including Arlington
# https://en.wikipedia.org/wiki/Boundary_markers_of_the_original_District_of_Columbia
dc_boundary = [
[38.790339, -77.040586], # South
[38.893245, -77.172301], # West
[38.995957, -77.040986], # North
[38.892861, -76.909166], # East
[38.790339, -77.040586], # Closing the loop back to South
]
centroid_lat = (38.790339 + 38.995957) / 2
centroid_lon = (-77.172301 + -76.909166) / 2
centroid = [centroid_lat, centroid_lon]
# Add a PolyLine to the map
folium.PolyLine(locations=dc_boundary, color="#70CEEF", weight=5, opacity=0.7).add_to(m)
# Add markers for each corner
folium.Marker(location=[38.790339, -77.040586], popup='South Corner').add_to(m)
folium.Marker(location=[38.893245, -77.172301], popup='West Corner').add_to(m)
folium.Marker(location=[38.995957, -77.040986], popup='North Corner').add_to(m)
folium.Marker(location=[38.892861, -76.909166], popup='East Corner').add_to(m)
# Save the map to an HTML file
m.save("dc_arlington_map.html")
# Display the map
m
@doabell
Copy link
Author

doabell commented Jan 26, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment