About This Book
* Learn to build a complete geospatial application from scratch using Python
* Create good-looking maps based on the results of your analysis
* This is a fast-paced guide to help you explore the key concepts of geospatial to obtain high quality spatial data
Who This Book Is For
If you are an experienced Python developer and wish to get up-to-speed with geospatial programming, then this book is for you. While familiarity with installing third-party Python libraries would be an advantage, no prior knowledge of geospatial programming is required.
In Detail
Python is a highly expressive language that makes it easy to write sophisticated programs. Combining high-quality geospatial data with Python geospatial libraries will give you a powerful toolkit for solving a range of geospatial programming tasks.
The book begins with an introduction to geospatial analysis and programming and explains the ideas behind geospatial data. You will explore Python libraries for building your own geospatial applications. You will learn to create a geospatial database for your application using PostGIS and the psycopg2 library, and see how the Mapnik library can be used to create attractive and useful maps.
Finally, you will learn to use the Shapely and NetworkX libraries to create, analyze, and manipulate complex geometric objects, before implementing a system to match GPS recordings against a database of roads to produce a heatmap of the most frequently used roads.
Author(s): Erik Westra
Publisher: Packt Publishing Ltd.
Year: 2015
Language: English
Pages: 180
Python Geospatial Analysis Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Geospatial Analysis and Techniques
About geospatial analysis
Understanding geospatial data
Setting up your Python installation
Installing GDAL
Installing Shapely
Obtaining some geospatial data
Unlocking the shapefile
Analyzing the data
A program to identify neighboring countries
Summary
2. Geospatial Data
Geospatial data quality
Types of geospatial data
Shapefiles
Well-known text
Well-known binary
Spatial databases
Geospatial microformats
GeoJSON
GML
Digital elevation models
Raster basemaps
Multiband raster files
Sources of freely available geospatial data
Natural Earth Data
OpenStreetMap
US Census Bureau
World Borders Dataset
GLOBE
National Elevation Dataset
Reading and writing geospatial data using Python
Reading vector data
Writing vector data
Reading raster data
Writing raster data
Dealing with spatial reference systems
WGS84
Universal Transverse Mercator
Describing spatial reference systems
Transforming coordinates
Calculating lengths and areas
Geospatial data errors and how to fix them
Points
LineStrings
Linear Rings
Polygons
MultiPolygons
Fixing invalid geometries
Summary
3. Spatial Databases
Spatial database concepts
Installing a spatial database
Installing PostgreSQL
Installing PostGIS
Installing psycopg2
Accessing PostGIS from Python
Setting up a spatial database
Importing spatial data
Querying spatial data
Manipulating spatial data
Exporting spatial data
Summary
4. Creating Maps
Introducing Mapnik
Installing Mapnik
A taste of Mapnik
Building a map
Styling a map
Learning Mapnik
Datasources
Symbolizers
PointSymbolizer
LineSymbolizer
PolygonSymbolizer
TextSymbolizer
RasterSymbolizer
Map rendering
A working example
Next steps
Summary
5. Analyzing Geospatial Data
Libraries for spatial analysis
PyProj
NetworkX
Spatial analysis recipes
Calculating and comparing coordinates
Calculating lengths
Calculating areas
Calculating shortest paths
Summary
6. Building a Complete Geospatial Analysis System
Matching GPS data against a map
An overview of the GPS Heatmap system
Obtaining the necessary data
Obtaining GPS data
Downloading the road data
Implementing the GPS Heatmap system
Initializing the database
Importing the road data
Splitting the road data into segments
Constructing a network of directed road segments
Implementing the map matching algorithm
Generating the GPS heatmap
Further improvements
Summary
Index