Author(s): Erik Westra
Edition: 3
Publisher: Packt Publishing
Year: 2016
Language: English
Pages: 446
Cover
Copyright
Credits
About the Author
About the Reviewer
www.PacktPub.com
Table of Contents
Preface
Chapter 1: Geospatial Development Using Python
Python
Python 3
Geospatial development
Applications of geospatial development
Analysing geospatial data
Visualizing geospatial data
Creating a geospatial mash-up
Recent developments
Summary
Chapter 2: GIS
Core GIS concepts
Location
Distance
Units
Projections
Cylindrical projections
Conic projections
Azimuthal projections
The nature of map projections
Coordinate systems
Datums
Shapes
GIS data formats
Working with GIS data manually
Obtaining the data
Installing GDAL
Installing GDAL on Linux
Installing GDAL on Mac OS X
Installing GDAL on MS Windows
Testing your GDAL installation
Examining the Downloaded Shapefile
Summary
Chapter 3: Python Libraries for Geospatial Development
Reading and writing geospatial data
GDAL/OGR
Installing GDAL/OGR
Understanding GDAL
GDAL example code
Understanding OGR
OGR example code
GDAL/OGR documentation
Dealing with projections
pyproj
Installing pyproj
Understanding pyproj
Proj
Geod
Example code
Documentation
Analyzing and manipulating Geospatial data
Shapely
Installing Shapely
Understanding Shapely
Shapely example code
Shapely documentation
Visualizing geospatial data
Mapnik
Installing Mapnik
Understanding Mapnik
Mapnik example code
Mapnik documentation
Summary
Chapter 4: Sources of Geospatial Data
Sources of geospatial data in vector format
OpenStreetMap
The OpenStreetMap data format
Obtaining and using OpenStreetMap data
TIGER
The TIGER data format
Obtaining and using TIGER data
Natural Earth
The Natural Earth data format
Obtaining and using Natural Earth vector data
The Global Self-consistent, Hierarchical, High-resolution Geography Database (GSHHG)
The GSHHG data format
Obtaining the GSHHG database
The World Borders Dataset
The World Borders Dataset data format
Obtaining the World Borders Dataset
Sources of geospatial data in raster format
Landsat
The Landsat data format
Obtaining Landsat imagery
Natural Earth
The Natural Earth data format
Obtaining and using Natural Earth raster data
Global Land One-kilometer Base Elevation (GLOBE)
The GLOBE data format
Obtaining and using GLOBE data
The National Elevation Dataset (NED)
The NED data format
Obtaining and using NED data
Sources of other types of geospatial data
The GEOnet Names Server
The GEOnet Names Server data format
Obtaining and using GEOnet Names Server data
The Geographic Names Information System (GNIS)
The GNIS data format
Obtaining and using GNIS data
Choosing your geospatial data source
Summary
Chapter 5: Working with Geospatial Data in Python
Pre-requisites
Working with geospatial data
Task – calculate the bounding box for each country in the world
Task – calculate the border between Thailand and Myanmar
Task – analyze elevations using a digital elevation map
Changing datums and projections
Task – changing projections to combine shapefiles using geographic and UTM coordinates
Task – changing the datums to allow older and newer TIGER data to be combined
Performing geospatial calculations
Task – identifying parks in or near urban areas
Converting and standardizing units of geometry and distance
Task – calculating the length of the Thai-Myanmar border
Task – finding a point 132.7 kilometers west of Shoshone, California
Exercises
Summary
Chapter 6: Spatial Databases
Spatially-enabled databases
Spatial indexes
Introducing PostGIS
Installing PostgreSQL
Installing PostGIS
Installing psycopg2
Setting up a database
Creating a Postgres user account
Creating a database
Allowing the user to access the database
Spatially enable the database
Using PostGIS
PostGIS documentation
Advanced PostGIS features
Recommended best practices
Best practice: use the database to keep track of spatial references
Best practice: use the appropriate spatial reference for your data
Option 1: Using GEOGRAPHY fields
Option 2: Transforming features as required
Option 3: Transforming features from the outset
When to use unprojected coordinates
Best practice: avoid on-the-fly transformations within a query
Best practice: don't create geometries within a query
Best practice: use spatial indexes appropriately
Best practice: know the limits of your database's query optimizer
Summary
Chapter 7: Using Python and Mapnik to Generate Maps
Introducing Mapnik
Creating an example map
Mapnik concepts
Data sources
Shapefile
PostGIS
Gdal
MemoryDatasource
Rules, filters, and styles
Filters
"Else" rules
Styles
Symbolizers
Drawing points
Drawing lines
Drawing polygons
Drawing text
Drawing raster images
Maps and layers
Map rendering
Summary
Chapter 8: Working with Spatial Data
About DISTAL
Designing and building the database
Downloading and importing the data
The World Borders Dataset
The GSHHG shoreline database
US place names
Non-US place names
Implementing the DISTAL application
The "select country" script
The "select area" script
Calculating the bounding box
Calculating the map's dimensions
Rendering the map image
The "show results" script
Identifying the clicked-on point
Identifying matching place names
Displaying the results
Using DISTAL
Summary
Chapter 9: Improving the DISTAL Application
Dealing with the anti-meridian line
Dealing with the scale problem
Performance
Finding the problem
Improving performance
Calculating the tiled shorelines
Using the tiled shorelines
Analyzing the performance improvement
Summary
Chapter 10: Tools for Web-Based Geospatial Development
Tools and techniques for geospatial web development
Web applications
A bare-bones approach
Web application stacks
Web application frameworks
User interface libraries
Web services
An example web service
Map rendering using a web service
Tile caching
The "slippy map" stack
Geospatial web protocols
A closer look at three specific tools and techniques
The Tile Map Service protocol
OpenLayers
GeoDjango
Learning Django
GeoDjango
Summary
Chapter 11: Putting It All Together – a Complete Mapping System
About the ShapeEditor
Designing the ShapeEditor
Importing a shapefile
Selecting a feature
Editing a feature
Exporting a shapefile
Prerequisites
Setting up the database
Setting up the ShapeEditor project
Defining the ShapeEditor's applications
Creating the shared application
Defining the data models
The Shapefile object
The Attribute object
The Feature object
The AttributeValue object
The models.py file
Playing with the admin system
Summary
Chapter 12: ShapeEditor – Importing and Exporting Shapefiles
Implementing the shapefile list view
Importing shapefiles
The Import Shapefile form
Extracting the uploaded shapefile
Importing the shapefile's contents
Opening the shapefile
Adding the Shapefile object to the database
Defining the shapefile's attributes
Storing the shapefile's features
Storing the shapefile's attributes
Cleaning up
Exporting shapefiles
Define the OGR shapefile
Saving the features into the shapefile
Saving the attributes into the shapefile
Compressing the shapefile
Deleting temporary files
Returning the ZIP archive to the user
Summary
Chapter 13: ShapeEditor – Selecting and Editing Features
Selecting the feature to edit
Implementing the Tile Map Server
Setting up the base map
Tile rendering
Completing the Tile Map Server
Using OpenLayers to display the map
Intercepting mouse clicks
Implementing the "Find Feature" view
Editing features
Adding features
Deleting features
Deleting shapefiles
Using the ShapeEditor
Further improvements and enhancements
Summary
Index