Python Geospatial Development - Third Edition
eBook - ePub

Python Geospatial Development - Third Edition

  1. 446 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Python Geospatial Development - Third Edition

About this book

Develop sophisticated mapping applications from scratch using Python 3 tools for geospatial developmentAbout This Book• Build web applications based around maps and geospatial data using Python 3.x• Install and use various toolkits and obtain geospatial data for use in your programs• This practical, hands-on book will teach you all about geospatial development in PythonWho This Book Is ForThis book is for experienced Python developers who want to learn about geospatial concepts, obtain and work with geospatial data, solve spatial problems, and build sophisticated map-based applications using Python.What You Will Learn• Access, manipulate, and display geospatial data from within your Python programs• Master the core geospatial concepts of location, distance, units, projections, and datums• Read and write geospatial data in both vector and raster format• Perform complex, real-world geospatial calculations using Python• Store and access geospatial information in a database• Use points, lines, and polygons within your Python programs• Convert geospatial data into attractive maps using Python-based tools• Build complete web-based mapping applications using PythonIn DetailGeospatial development links your data to locations on the surface of the Earth. Writing geospatial programs involves tasks such as grouping data by location, storing and analyzing large amounts of spatial information, performing complex geospatial calculations, and drawing colorful interactive maps. In order to do this well, you'll need appropriate tools and techniques, as well as a thorough understanding of geospatial concepts such as map projections, datums, and coordinate systems.This book provides an overview of the major geospatial concepts, data sources, and toolkits. It starts by showing you how to store and access spatial data using Python, how to perform a range of spatial calculations, and how to store spatial data in a database. Further on, the book teaches you how to build your own slippy map interface within a web application, and finishes with the detailed construction of a geospatial data editor using the GeoDjango framework.By the end of this book, you will be able to confidently use Python to write your own geospatial applications ranging from quick, one-off utilities to sophisticated web-based applications using maps and other geospatial data.Style and approach This book is a comprehensive course in geospatial development. The concepts you need to know are presented in a hands-on fashion with example code to help you to solve real-world problems right away. Larger programs are built up step by step while guiding you through the process of building your own sophisticated mapping applications.

Tools to learn more effectively

Saving Books

Saving Books

Keyword Search

Keyword Search

Annotating Text

Annotating Text

Listen to it instead

Listen to it instead

Information

Python Geospatial Development Third Edition


Table of Contents

Python Geospatial Development Third Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
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 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
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
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
4. Sources of Geospatial Data
Sources of geospatial data in vector format
OpenStreetMap
The OpenStreetMap data format
Obtaining and using OpenStreetMap data
The OpenStreetMap APIs
Planet.osm
Mirror sites and extracts
Working with 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
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
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
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
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
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
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
GeoDj...

Table of contents

  1. Python Geospatial Development Third Edition

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access Python Geospatial Development - Third Edition by Erik Westra in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in Python. We have over one million books available in our catalogue for you to explore.