The purpose of reading this book is to record Python's tools for geospatial analysis, mainly open source things; turn it over quickly and record it
Overview section
- Ebola and the Ushahidi disaster system
- Lascaux cave, southwestern France, star map mural abstraction of things
- Mapping of conditions and wells during the European cholera epidemic of 1832 The distribution relationship between the two
- Sequence diagram of Napoleon's defeat in Russia in 1812, drawn by French engineers in 1869 Integrate the expression of timeline, line width, color, text, etc.
- The first GIS system - Canadian National Geographic Information System CGIS
- Remote sensing - long-distance detection, such as Landsat, etc.
- DEM - digital elevation model, such as SRTM (90m), GDEM (30m), WorldDEM (4m, asking for money), etc.
- CAD - computer-aided cartography, the difference from GIS cartography is the coordinates (GIS geographic coordinates)
- OSM - OpenStreetMap, an open source GIS crowdsourced data
- GIS basic concepts: thematic map, spatial database, spatial index, metadata, map projection, rendering, image data, remote sensing color
- GIS vector basic concepts: data structures, buffers, fusion, simplification, overlay, merge, contain, union, join, topology
- Basic concepts of GIS raster: band operation, change monitoring, histogram, feature extraction, supervised classification, unsupervised classification
- A small example is made with the turtle module, a graphics engine based on the Tkinter library
geospatial data
- The Internet map uses the web Mercator projection, made by Google, the original number EPSG: 900913, the official number EPSG: 3857
- Spatial indexing methods: quad tree, R tree
- Map tiles: grids and generalizations, graded images
- Open source vector library OGR supports 86+ vector formats, commercial FME supports 188+
- Shapefile format - Esri's and open standards, including .shp/.shx/.dbf|.sbn/.sbx/.prj etc.
- AutoCAD file formats - DXF, DWG, limited use in geospatial analysis
- Tag and markup formats - XML/KML/OSM/GML/GeoJSON/SVG/WKT (commonly used in prj)
- GeoJSON: One of the JSON formats, seamlessly integrated with Javascript, commonly used in WebGIS development
- Image data - ASCII text files, TIFF, regular images (JPEG/GIF/BMP/PNG, georeferenced text assistance required), complex types (NetCDF, GRIB, HDF5, for ocean, meteorology, etc.), compressed formats, etc.
- Point cloud data - generated by laser, radar, etc., for 3D
Geospatial Technology Overview
- 4 core functions implemented by geospatial software packages: data access, geometric computation, visualization, metadata tools
- GDAL, OGR, GEOS, PROJ.4 are the core and soul of the geospatial analysis industry commercial and open source software, all written in C/C++. In addition, let's take a look at GeoTools written in Java
- GDAL: Geospatial data abstraction library, mainly for raster data access processing
- OGR: Simple Feature Library, Oriented to Vector Data Access Processing
- PROJ.4: for map projection
- CGAL: A library of computational geometry algorithms, such as polygonal straight skeleton lines
- JTS: Java Topology Suite, a Java-implemented Geospatial Computational Geometry Library
- GEOS: The open source geometry engine is the C++ version of the JTS library. The existing scripting languages including Python are automatically bound to the GEOS library.
- PostGIS: The module of the open source relational database PostgreSQL, mostly provided by GEOS, realizes SQL query spatial data
- Other databases that support spatial analysis: Oracle Spatial, ArcSDE, Microsoft SQL Server, MySQL, SpatialLite
- Routing Analysis - Esri Network Analysis, PostGIS's open source pgRouting engine
- Desktop tools - QGIS, OpenEV, GRASS GIS, uDig, gvSIG, OpenJUMP, Google Earth, NASA World Wind, ArcGIS; (Domestic: Supermap, MapGIS, GeoStar, etc.)
- Metadata management - GeoNetwork, CatMDEdit
Python Geospatial Analysis Tools
- GDAL installation - source code compilation, part of larger software, installation of binary distributions
Python networking library
import urllib import ftplib import zipfile import tarfile
Python's tag parser
#历史悠久(自带) from xml.dom import minidom #元素树(自带) try: import xml.etree.cElementTree as ET except ImportError: import xml.etree.ElementTree as ET #专业解析HTML(等格式混乱的XML文件) from bs4 import BeautifulSoup
WKT text. Note: shapely provides a set of Pythonic interfaces for GEOS
#使用shapely import shapely.wkt #也可以用OGR库 from osgeo import ogr ...
Python processing json
#使用json模块(自带) import json #使用geojson模块 import geojson
PyShp, used to read and write Shapefile files, does not support any geometric operations, only calls the Python standard library
import shapefile
dbfpy3, Python implementation, specializing in processing dbf files
from dbfpy3 import dbf
Shapely, a general-purpose geometry library, is a high-level, Python-style library for GEOS library geometry operations, avoiding file access and focusing only on geometry operations
import shapely
Finoa, provides a concise Python API for the data access function of the OGR library, the default GeoJSON format
import finoa
GDAL, handles raster data; OGR, general-purpose vector database
from osgeo import ogr from osgeo import gdal
- NumPy, for fast processing of Python arrays, scientific computing, etc., implemented in C
- PIL, for image editing, implemented in C
- PNGCanvas, lightweight image editing implemented in Python
- GeoPandas, a geospatial extension to Pandas built from Shapely, Fiona, PyProj, matplotlib, Descartes, and other must-have libraries, with database support
- PyMySQL, provides a complete set of APIs implemented in Python to implement MySQL's spatial data support
- PyFPDF, written in Python, handles PDF files
- Spectral Python, SPy, Python spectral function package, handles remote sensing applications, especially hyperspectral
Python and GIS
- Distance from both sides: plane (Pythagorean), spherical (haversine), ellipsoid (Vincenty formula)
- Orientation calculation
- Coordinate transformation
- reprojection
- Shapefile editing
- Inquire
- visualization
- Spreadsheets
- GPS data
- Geocoding (geocoder-Google Maps, geopy-OSM)
Python and Remote Sensing
Omitted, mainly GDAL and PIL, PNGCanvas; examples include image band transformation, image histogram creation, image classification, image feature extraction, change monitoring applications
Python with elevation data
- ASCII grid elevation files: gdal, numpy
- Shaded relief map: linecache, numpy
- Create contour lines: gdal
- LIDAE data meshing: laspy, PIL; voronoi creates Delaunay triangulation
Python Geospatial Advanced Modeling
This chapter is a few examples that illustrate the problem solving process
Examples : a crop health map, a flood inundation model, a shaded map, a terrain path map, a street path map, a map with photos Geo-connected shapefiles
Real-time data
- The moment a map is made, it is out of date
- API for real-time traffic conditions
- Weather Tracker, Iowa State University's Mesonet platform provides free, real-time weather data applications
- NOAA provides a set of WMS interfaces to access OSM
- SRTM.py provides DEM download