Home Page Icon
Home Page
Table of Contents for
Python Geospatial Development
Close
Python Geospatial Development
by Erik Westra
Python Geospatial Development
Python Geospatial Development
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 placement
Repeating labels
Controlling text overlap
Drawing text on a dark background
Adjusting the position of the text
Splitting labels across multiple lines
Controlling character and line spacing
Controlling capitalization
Drawing points
PointSymbolizer
ShieldSymbolizer
Drawing raster images
Using colors
Maps and layers
Map attributes and methods
Layer attributes and methods
Map rendering
MapGenerator revisited
The MapGenerator's interface
Creating the main map layer
Displaying points on the map
Rendering the map
What the map generator teaches us
Map definition files
Summary
9. Web Frameworks for Python Geo-Spatial Development
Web application concepts
Web application architecture
A bare-bones approach
Web application stacks
Web application frameworks
Web services
Map rendering
Tile caching
Web servers
User interface libraries
The "slippy map" stack
The geo-spatial web application stack
Protocols
The Web Map Service (WMS) protocol
WMS-C
The Web Feature Service (WFS) protocol
The TMS (Tile Map Service) protocol
Tools
Tile caching
TileCache
mod_tile
TileLite
User interface libraries
OpenLayers
Mapiator
Web application frameworks
GeoDjango
Understanding Django
GeoDjango
MapFish
TurboGears
Summary
10. Putting it All Together: A Complete Mapping Application
About the ShapeEditor
Designing the application
Importing a Shapefile
Selecting a feature
Editing a feature
Exporting a Shapefile
Prerequisites
The structure of a Django application
Models
Views
Templates
Setting up the database
Setting up the GeoDjango project
Setting up the ShapeEditor application
Defining the data models
Shapefile
Attribute
Feature
AttributeValue
The models.py file
Playing with the admin system
Summary
11. ShapeEditor: Implementing List View, Import, and Export
Implementing the "List Shapefiles" view
Importing Shapefiles
The "import shapefile" form
Extracting the uploaded Shapefile
Importing the Shapefile's contents
Open the Shapefile
Add the Shapefile object to the database
Define the Shapefile's attributes
Store the Shapefile's features
Store 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
12. ShapeEditor: Selecting and Editing Features
Selecting a feature to edit
Implementing the Tile Map Server
Setting up the base map
Tile rendering
Parsing the query parameters
Setting up the map
Defining the base layer
Defining the feature layer
Rendering the Map Tile
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 ShapeEditor
Further improvements and enhancements
Summary
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Cover
Next
Next Chapter
Python Geospatial Development
Python Geospatial Development
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset