Table of Contents for
Python Geospatial Development - Third Edition

Version ebook / Retour

Cover image for bash Cookbook, 2nd Edition Python Geospatial Development - Third Edition by Erik Westra Published by Packt Publishing, 2016
  1. Cover
  2. Table of Contents
  3. Python Geospatial Development Third Edition
  4. Python Geospatial Development Third Edition
  5. Credits
  6. About the Author
  7. About the Reviewer
  8. www.PacktPub.com
  9. Preface
  10. What you need for this book
  11. Who this book is for
  12. Conventions
  13. Reader feedback
  14. Customer support
  15. 1. Geospatial Development Using Python
  16. Geospatial development
  17. Applications of geospatial development
  18. Recent developments
  19. Summary
  20. 2. GIS
  21. GIS data formats
  22. Working with GIS data manually
  23. Summary
  24. 3. Python Libraries for Geospatial Development
  25. Dealing with projections
  26. Analyzing and manipulating Geospatial data
  27. Visualizing geospatial data
  28. Summary
  29. 4. Sources of Geospatial Data
  30. Sources of geospatial data in raster format
  31. Sources of other types of geospatial data
  32. Choosing your geospatial data source
  33. Summary
  34. 5. Working with Geospatial Data in Python
  35. Working with geospatial data
  36. Changing datums and projections
  37. Performing geospatial calculations
  38. Converting and standardizing units of geometry and distance
  39. Exercises
  40. Summary
  41. 6. Spatial Databases
  42. Spatial indexes
  43. Introducing PostGIS
  44. Setting up a database
  45. Using PostGIS
  46. Recommended best practices
  47. Summary
  48. 7. Using Python and Mapnik to Generate Maps
  49. Creating an example map
  50. Mapnik concepts
  51. Summary
  52. 8. Working with Spatial Data
  53. Designing and building the database
  54. Downloading and importing the data
  55. Implementing the DISTAL application
  56. Using DISTAL
  57. Summary
  58. 9. Improving the DISTAL Application
  59. Dealing with the scale problem
  60. Performance
  61. Summary
  62. 10. Tools for Web-based Geospatial Development
  63. A closer look at three specific tools and techniques
  64. Summary
  65. 11. Putting It All Together – a Complete Mapping System
  66. Designing the ShapeEditor
  67. Prerequisites
  68. Setting up the database
  69. Setting up the ShapeEditor project
  70. Defining the ShapeEditor's applications
  71. Creating the shared application
  72. Defining the data models
  73. Playing with the admin system
  74. Summary
  75. 12. ShapeEditor – Importing and Exporting Shapefiles
  76. Importing shapefiles
  77. Exporting shapefiles
  78. Summary
  79. 13. ShapeEditor – Selecting and Editing Features
  80. Editing features
  81. Adding features
  82. Deleting features
  83. Deleting shapefiles
  84. Using the ShapeEditor
  85. Further improvements and enhancements
  86. Summary
  87. Index

Sources of other types of geospatial data

The vector and raster geospatial data we have looked at so far is generally used to provide images or information about the Earth itself. However, geospatial applications often have to place data onto the surface of the Earth, that is, georeference something such as a place or event. In this section, we will look at two additional databases that provide information about the location of cities, towns, natural features, and points of interest on the surface of the Earth.

This data can be used in two important ways. First, it can be used to label features, for example, to place the label "London" onto a georeferenced image of southern England. Secondly, this data can be used to locate something by name, for example, by allowing the user to choose a city from a drop-down list and then draw a map centered around that city.

The GEOnet Names Server

The GEOnet Names Server provides a large database of place names. It is an official repository of non-American place names, as decided by the US Board on Geographic Names.

The following is an extract from the GEOnet Names Server database:

The GEOnet Names Server

As you can see from this example, this database includes longitude and latitude values as well as codes indicating the type of place (populated place, administrative district, natural feature, and so on), the elevation (where relevant), and a code indicating the type of name (official, conventional, historical, and so on).

The GEOnet Names Server database contains approximately 6 million features and 10 million names. It includes every country other than the US and Antarctica.

The GEOnet Names Server data format

The GEOnet Names Server's data is provided as a simple tab-delimited text file, where the first row in the file contains the field names, and subsequent rows contain the various features, one per row. Importing this name data into a spreadsheet or database is trivial.

For more information on the supplied fields and what the various codes mean, refer to http://geonames.nga.mil/gns/html/gis_countryfiles.html.

Obtaining and using GEOnet Names Server data

The main site for the GEOnet Names Server is http://geonames.nga.mil/gns/html.

The main interface to the GEOnet Names Server is through various search tools that provide filtered views of the data. To download the data directly rather than searching, go to http://geonames.nga.mil/gns/html/namefiles.html.

Each country is listed; simply click on the hyperlink for the country you want data for, and your browser will download a .zip file containing a number of tab-delimited text files containing all the features within that country. The data for each country is provided both as a single combined file as well as a separate file for each feature type.

As well as downloading each country's data individually, there is also an option to download all the countries in one file, which is a 460MB download.

Once you have downloaded the files and decompressed them, you can load the files directly into a spreadsheet or database for further processing. By filtering on the Feature Classification (FC), Feature Designation Code (DSG), and other fields, you can select the particular set of place names you want and then use that data directly in your application.

The Geographic Names Information System (GNIS)

The Geographic Names Information System (GNIS) is the US equivalent of the GEOnet Names Server—it contains name information for the United States.

The following is an extract from the GNIS database:

The Geographic Names Information System (GNIS)

GNIS includes natural, physical, and cultural features, though it does not include road or highway names.

As with the GEOnet Names Server, the GNIS database contains the official names used by the US government, as decided by the US Board on Geographic Names. GNIS is run by the US Geological Survey and currently contains over 2.2 million features.

The GNIS data format

GNIS names are available for download as pipe-delimited compressed text files. This format uses the pipe character (|) to separate the various fields:

FEATURE_ID|FEATURE_NAME|FEATURE_CLASS|...
1397658|Ester|Populated Place|...
1397926|Afognak|Populated Place|...

The first line contains the field names, and subsequent lines contain the various features. The available information includes the name of the feature, its type, elevation, the county and state the feature is in, the latitude/longitude coordinate of the feature itself, and the latitude/longitude coordinate of the origin of the feature (for streams, valleys, and so on).

Obtaining and using GNIS data

The main GNIS web site can be found at http://geonames.usgs.gov/domestic.

Click on the Download Domestic Names hyperlink, and you will be given options to download all the GNIS data on a state-by-state basis or download all the features in a single large download. You can also download "topical gazetteers" that include selected subsets of the data—all populated places, all historical places, and so on.

If you click on one of the File Format hyperlinks, a pop-up window will appear describing the structure of the files in more detail.

Once you have downloaded the data you want, you can simply import the file into a database or spreadsheet. To import into a spreadsheet, use the Delimited format and enter | as the custom delimiter character. You can then sort or filter the data in whatever way you want so that you can use it in your application.