Skip to Main Content
Learning Geospatial Analysis with Python - Third Edition
book

Learning Geospatial Analysis with Python - Third Edition

by Joel Lawhead
September 2019
Beginner content levelBeginner
456 pages
10h 53m
English
Packt Publishing
Content preview from Learning Geospatial Analysis with Python - Third Edition

Retrieving weather data

In this section, we will retrieve our final data element: the weather. As mentioned earlier, we will use the Dark Sky service, which allows us to gather historical weather reports for any place in the world. The weather API is REST and JSON-based, so we'll use the urllib module to request data and the json library to parse it. Of note in this section is that we cache the data locally, so you can run the script offline for testing if need be. Early on in this section is where you place your Dark Sky API key that is flagged by the YOUR KEY HERE text. Let's have a look at the following steps:

  1. First, we need the center of our area of interest:
log.info("Creating weather summary")# Get the bounding box centroid for georeferencing ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Geospatial Analysis with Python

Mastering Geospatial Analysis with Python

Silas Toms, Eric van Rees, Paul Crickard

Publisher Resources

ISBN: 9781789959277Supplemental Content