Skip to content

Commit

Permalink
Generate from online sources directly
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrandwijk committed Jan 22, 2025
1 parent 2f16d2c commit 131c745
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions dev/generate_extents.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
""" Generate a shapefile with the extents of the regions for all providers.
Source of this data: https://www.naturalearthdata.com/downloads/"""
""" Generate a shapefile with the extents of the regions for all providers."""

import pandas
import shapely
import geopandas

# prepare state and country files for uniform reading
states = geopandas.read_file("ne_10m_admin_1_states_provinces.zip")
countries = geopandas.read_file("ne_50m_admin_0_countries.zip")
states = geopandas.read_file(
(
"https://github.com/nvkelso/natural-earth-vector/raw/refs/heads/"
"master/10m_cultural/ne_10m_admin_1_states_provinces.shp"
)
)
countries = geopandas.read_file(
(
"https://github.com/nvkelso/natural-earth-vector/raw/refs/heads/master/"
"50m_cultural/ne_50m_admin_0_countries.shp"
)
)
countries.rename(columns={"NAME": "name"}, inplace=True)

combined = pandas.concat([states, countries])
print("combined", combined["geometry"].head())

# handling by name (for most of them)
names = [
Expand Down
Binary file removed dev/ne_10m_admin_1_states_provinces.zip
Binary file not shown.
Binary file removed dev/ne_50m_admin_0_countries.zip
Binary file not shown.

0 comments on commit 131c745

Please sign in to comment.