Skip to content

Commit

Permalink
natural earth data / cartopy
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldorman committed Aug 11, 2023
1 parent b59530a commit db45d6e
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 42 deletions.
30 changes: 29 additions & 1 deletion 08-read-write-plot.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,35 @@ ne.plot();

## Geographic data packages {#sec-geographic-data-packages}

To complete...
Many Python packages have been developed for accessing geographic data, some of which are presented in @tbl-data-packages.
These provide interfaces to one or more spatial libraries or geoportals and aim to make data access even quicker from the command line.

| Package | Description |
|---|-----------|
| `cartopy` | Download layers from [Natural Earth Data](https://www.naturalearthdata.com/downloads/) |
| `...` | ... |
| `...` | ... |
| `...` | ... |
: Selected Python packages for geographic data retrieval {#tbl-data-packages}

Each data package has its own syntax for accessing data.
This diversity is demonstrated in the subsequent code chunks, which show how to get data using three packages from @tbl-data-packages.
Country borders are often useful and these can be accessed with the ne_countries() function from the rnaturalearth package as follows:

```{python}
import cartopy
filename = cartopy.io.shapereader.natural_earth(
resolution='10m',
category='cultural',
name='admin_2_counties'
)
counties = gpd.read_file(filename)
counties
```

```{python}
counties.plot();
```

## Geographic web services

Expand Down
82 changes: 41 additions & 41 deletions output/plot_rasterio2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified output/world.gpkg
Binary file not shown.
Binary file modified output/world_many_features.gpkg
Binary file not shown.
Binary file modified output/world_many_layers.gpkg
Binary file not shown.

0 comments on commit db45d6e

Please sign in to comment.