Skip to content

Commit

Permalink
Directly download naturalearth countries dataset.
Browse files Browse the repository at this point in the history
  • Loading branch information
SpacemanPaul committed Jul 11, 2024
1 parent d020f21 commit 978528f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions odc/geo/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def gbox_css() -> str:
return src.read()


ne_countries_url = "https://naciscdn.org/naturalearth/110m/cultural/ne_110m_admin_0_countries.zip"

def country_geom(iso3: str, crs: MaybeCRS = None) -> Geometry:
"""
Extract geometry for a country from geopandas sample data.
Expand All @@ -57,8 +59,8 @@ def country_geom(iso3: str, crs: MaybeCRS = None) -> Geometry:

with catch_warnings():
filterwarnings("ignore", category=FutureWarning)
df = gpd.read_file(gpd.datasets.get_path("naturalearth_lowres"))
(gg,) = from_geopandas(df[df.iso_a3 == iso3])
df = gpd.read_file(ne_countries_url)
(gg,) = from_geopandas(df[df.ISO_A3 == iso3])
crs = norm_crs(crs)
if crs is not None:
gg = gg.to_crs(crs)
Expand Down

0 comments on commit 978528f

Please sign in to comment.