Python Geospatial Development
eBook - ePub

Python Geospatial Development

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

Python Geospatial Development

About this book

In Detail

Open Source GIS (Geographic Information System) is a growing area with the explosion of applications such as Google Maps, Google Earth, and GPS. The GIS market is growing rapidly and as a Python developer you will find yourself either wanting grounding in GIS or needing to get up to speed to do your job. In today's location-aware world, all commercial Python developers can benefit from an understanding of GIS development gained using this book.

Working with geo-spatial data can get complicated because you are dealing with mathematical models of the Earth's surface. Since Python is a powerful programming language with high-level toolkits, it is well suited to GIS development. will familiarize you with the Python tools required for geo-spatial development such as Mapnik, which is used for mapping in Python. It introduces GIS at the basic level with a clear, detailed walkthrough of the key GIS concepts such as location, distance, units, projections, datums, and GIS data formats. We then examine a number of Python libraries and combine these with geo-spatial data to accomplish a variety of tasks. The book provides an in-depth look at the concept of storing spatial data in a database and how you can use spatial databases as tools to solve a variety of geo-spatial problems.

It goes into the details of generating maps using the Mapnik map-rendering toolkit, and helps you to build a sophisticated web-based geo-spatial map-editing application using GeoDjango, Mapnik, and PostGIS. By the end of the book, you will be able to integrate spatial features into your applications and build a complete mapping application from scratch.

A hands-on tutorial about accessing, manipulating, and displaying Geo-Spatial data efficiently using a range of Python tools for GIS development

Approach

This is a tutorial style book that will teach usage of Python tools for GIS using simple practical examples and then show you how to build a complete mapping application from scratch. The book assumes basic knowledge of Python. No knowledge of Open Source GIS is required.

Who this book is for

This book is useful for Python developers who want to get up to speed with Open Source GIS in order to build GIS applications or integrate Geo-Spatial features into their applications.

Trusted by 375,005 students

Access to over 1 million titles for a fair monthly price.

Study more efficiently using our study tools.

Python Geospatial Development


Table of Contents

Python Geospatial Development
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
Errata
Piracy
Questions
1. Geo-Spatial Development Using Python
Python
Geo-spatial development
Applications of geo-spatial development
Analyzing geo-spatial data
Visualizing geo-spatial data
Creating a geo-spatial 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
Summary
3. Python Libraries for Geo-Spatial Development
Reading and writing geo-spatial data
GDAL/OGR
GDAL design
GDAL example code
OGR design
OGR example code
Documentation
Availability
Dealing with projections
pyproj
Design
Proj
Geod
Example code
Documentation
Availability
Analyzing and manipulating geo-spatial data
Shapely
Design
Example code
Documentation
Availability
Visualizing geo-spatial data
Mapnik
Design
Example code
Documentation
Availability
Summary
4. Sources of Geo-Spatial Data
Sources of geo-spatial data in vector format
OpenStreetMap
Data format
Obtaining and using OpenStreetMap data
The OpenStreetMap API
Planet.osm
Mirror sites
Working with OpenStreetMap XML data
TIGER
Data format
Obtaining and using TIGER data
Digital Chart of the World
Data format
Available layers
Obtaining and using DCW data
GSHHS
Data format
Obtaining the GSHHS database
World Borders Dataset
Data format
Obtaining the World Borders Dataset
Sources of geo-spatial data in raster format
Landsat
Data format
Obtaining Landsat imagery
GLOBE
Data format
Obtaining and using GLOBE data
National Elevation Dataset
Data format
Obtaining and using NED data
Sources of other types of geo-spatial data
GEOnet Names Server
Data format
Obtaining and using GEOnet Names Server data
GNIS
Data format
Obtaining and using GNIS data
Summary
5. Working with Geo-Spatial Data in Python
Prerequisites
Reading and writing geo-spatial data
Task: Calculate the bounding box for each country in the world
Task: Save the country bounding boxes into a Shapefile
Task: Analyze height data using a digital elevation map
Changing datums and projections
Task: Change projections to combine Shapefiles using geographic and UTM coordinates
Task: Change datums to allow older and newer TIGER data to be combined
Representing and storing geo-spatial data
Task: Calculate the border between Thailand and Myanmar
Task: Save geometries into a text file
Working with Shapely geometries
Task: Identify parks in or near urban areas
Converting and standardizing units of geometry and distance
Task: Calculate the length of the Thai-Myanmar border
Task: Find a point 132.7 kilometers west of Soshone, California
Exercises
Summary
6. GIS in the Database
Spatially-enabled databases
Spatial indexes
Open source spatially-enabled databases
MySQL
PostGIS
Installing and configuring PostGIS
Using PostGIS
Documentation
Advanced PostGIS features
SpatiaLite
Installing SpatiaLite
Mac OS X
MS Windows
Linux
Installing pysqlite
Accessing SpatiaLite from Python
Documentation
Using SpatiaLite
SpatiaLite capabilities
Commercial spatially-enabled databases
Oracle
MS SQL Server
Recommended best practices
Use the database to keep track of spatial references
Use the appropriate spatial reference for your data
Option 1: Use a database that supports geographies
Option 2: Transform features as required
Option 3: Transform features from the outset
When to use unprojected coordinates
Avoid on-the-fly transformations within a query
Don't create geometries within a query
Use spatial indexes appropriately
Know the limits of your database's query optimizer
MySQL
PostGIS
SpatiaLite
Working with geo-spatial databases using Python
Prerequisites
Working with MySQL
Working with PostGIS
Working with SpatiaLite
Speed comparisons
Summary
7. Working with Spatial Data
About DISTAL
Designing and building the database
Downloading the data
World Borders Dataset
GSHHS
Geonames
GEOnet Names Server
Importing the data
World Borders Dataset
GSHHS
US placename data
Worldwide placename data
Implementing the DISTAL application
The "Select Country" script
The "Select Area" script
Calculating the bounding box
Calculating the map's dimensions
Setting up the datasource
MySQL
PostGIS
SpatiaLite
Rendering the map image
The "Show Results" script
Identifying the clicked-on point
Identifying features by distance
Calculating distances manually
Using angular distances
Using projected coordinates
A hybrid approach
Spatial joins
Identifying points by true distance
Displaying the results
Application review and improvements
Usability
Quality
Placename issues
Lat/Long coordinate problems
Performance
Finding the problem
Improving performance
Calculating the tiled shorelines
Using the tiled shorelines
Analyzing the performance improvement
Further performance improvements
Scalability
Summary
8. Using Python and Mapnik to Generate Maps
Introducing Mapnik
Creating an example map
Mapnik in depth
Data sources
Shapefile
PostGIS
GDAL
OGR
SQLite
OSM
PointDatasource
Rules, filters, and styles
Filters
Scale denominators
"Else" rules
Symbolizers
Drawing lines
LineSymbolizer
Line color
Line width
Opacity
Line caps
Line joins
Dashed and dotted lines
LinePatternSymbolizer
Drawing polygons
PolygonSymbolizer
Fill color
Opacity
Gamma correction
PolygonPatternSymbolizer
Drawing labels
TextSymbolizer
Specifying the text to be displayed
Selecting a suitable font
Drawing semi-transparent text
Controlling text placem...

Table of contents

  1. Python Geospatial Development

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 by Erik Westra in PDF and/or ePUB format, as well as other popular books in Computer Science & Application Development. We have over one million books available in our catalogue for you to explore.