Book Image

Python Geospatial Analysis Essentials

By : Erik Westra
Book Image

Python Geospatial Analysis Essentials

By: Erik Westra

Overview of this book

Table of Contents (13 chapters)
Python Geospatial Analysis Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Obtaining some geospatial data


For this chapter, we will use a simple but still very useful geospatial data file called World Borders Dataset. This dataset consists of a single shapefile where each feature within the shapefile represents a country. For each country, the associated geometry object represents the country's outline. Additional attributes contain metadata such as the name of the country, its ISO 3166-1 code, the total land area, its population, and its UN regional classification.

To obtain the World Border Dataset, go to http://thematicmapping.org/downloads/world_borders.php.

Scroll down to the Downloads section and click on the file to download. Make sure you download the full version and not the simplified one—the file you want will be called TM_WORLD_BORDERS-0.3.zip.

Note that the shapefile comes in the form of a ZIP archive. This is because a shapefile consists of multiple files, and it is easier to distribute them if they are stored in a ZIP archive. After downloading the file, double-click on the ZIP archive to decompress it. You will end up with a directory named TM_WORLD_BORDERS-0.3. Inside this directory should be the following files:

The following table explains these various files and what information they contain:

Filename

Description

Readme.txt

This is your typical README file, containing useful information about the shapefile.

TM_WORLD_BORDERS-0.3.shp

This file contains the geometry data for each feature.

TM_WORLD_BORDERS-0.3.shx

This is an index into the .shp file, making it possible to quickly access the geometry for a given feature.

TM_WORLD_BORDERS-0.3.dbf

This is a database file holding the various attributes for each feature.

TM_WORLD_BORDERS-0.3.prj

This file describes the coordinate system and projection used by the data, as a plain text file.

Place this directory somewhere convenient. We will be using this dataset extensively throughout this book, so you may want to keep a backup copy somewhere.