Mastering Geospatial analysis with Python explore GIS processing and learn to work with GeoDjango, CARTOframes and MapboxGL-Jupyter

Python comes with many libraries and tools that help you work on geoprocessing tasks without investing in expensive tools. This book introduces you to new libraries that perform geospatial and statistical analysis and data management. It uses examples that explain how Python v3 differs from v2, and...

Descripción completa

Detalles Bibliográficos
Otros Autores: Crickard, Paul, author (author), Rees, Eric van, author, Toms, Silas, author
Formato: Libro electrónico
Idioma:Inglés
Publicado: Birmingham ; Mumbai : Packt [2018]
Edición:1st ed
Materias:
Ver en Biblioteca Universitat Ramon Llull:https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009707736006719
Tabla de Contenidos:
  • Cover
  • Copyright and Credits
  • Packt Upsell
  • Contributors
  • Table of Contents
  • Preface
  • Chapter 1: Package Installation and Management
  • Introducing Anaconda
  • Installing Python using Anaconda
  • Running a Jupyter Notebook
  • Running a Notebook
  • Creating a new Notebook
  • Adding code
  • Managing Python packages
  • Managing packages with Anaconda Navigator
  • Online searching for packages using Anaconda Cloud
  • Managing Python packages with conda
  • Managing Python packages using pip
  • Upgrading and uninstalling the package with pip
  • Python virtual environments
  • Virtual environments using Anaconda
  • Managing environments with conda
  • Virtual environments using virtualenv
  • Summary
  • Chapter 2: Introduction to Geospatial Code Libraries
  • Geospatial Data Abstraction Library (GDAL) and the OGR Simple Features Library
  • Installing GDAL
  • Installing GDAL using Anaconda3
  • Installing GDAL using conda
  • Installing GDAL using pip
  • Installing a second GDAL version using pip
  • Other recommended GDAL resources
  • GEOS
  • Installing GEOS
  • Shapely
  • Installing Shapely
  • Fiona
  • Installing Fiona
  • Python shapefile library (pyshp)
  • Installing pyshp
  • pyproj
  • Installing pyproj
  • Rasterio
  • Rasterio dependencies
  • Installation of Rasterio
  • GeoPandas
  • GeoPandas installation
  • GeoPandas dependencies
  • How it all works together
  • Summary
  • Chapter 3: Introduction to Geospatial Databases
  • Installing PostgreSQL and PostGIS on Windows
  • Installing PostgreSQL and PostGIS on Mac
  • Working with PostgreSQL and PostGIS using Python
  • Connecting to PostgreSQL using psycopg2
  • Installing psycopg2
  • Connecting to the database and creating a table
  • Adding data to the table
  • Shapely
  • Querying the data
  • Changing the CRS
  • Buffer
  • Distance and near
  • Lines in the database
  • Length of a line.
  • Intersecting lines
  • Polygons in the database
  • Point in polygon
  • Summary
  • Chapter 4: Data Types, Storage, and Conversion
  • Raster and vector data
  • Shapefiles
  • GeoJSON
  • KML
  • GeoPackage
  • Raster data formats
  • Reading and writing vector data with GeoPandas
  • Reading and writing vector data with OGR
  • Reading and writing raster data with Rasterio
  • Reading and writing raster data using GDAL
  • Summary
  • Chapter 5: Vector Data Analysis
  • OGR Simple Features Library
  • OGR batch commands
  • ogrmerge
  • The OGR library and Python bindings
  • OGR's main modules and classes
  • Creating polygon geometry with OGR
  • Creating polygon geometry from GeoJSON
  • Basic geometric operations
  • Writing polygon data to a newly created shapefile
  • Using a spatial filter to select features
  • Shapely and Fiona
  • Shapely objects and classes
  • Shapely methods for geospatial analysis
  • Fiona's data model
  • Creating geometries with Shapely
  • Applying geometrical methods with Shapely
  • Reading JSON geometries with Shapely
  • Reading data with Fiona
  • Accessing vector geometry in shapefiles using Shapely and Fiona
  • GeoPandas
  • Geospatial analysis with GeoPandas
  • Selecting and plotting geometry data with GeoPandas and Matplotlib
  • Mapping wildfire data with GeoPandas
  • Why data inspection matters
  • Summary
  • Chapter 6: Raster Data Processing
  • Raster operations using GDAL
  • Using the GDAL library to load and query rasters
  • Using GDAL to create rasters
  • Raster operations using PostgreSQL
  • Loading rasters into PostgreSQL
  • Performing queries on rasters using PostgreSQL
  • Querying raster metadata
  • Queries returning geometry
  • Queries returning values
  • Summary
  • Chapter 7: Geoprocessing with Geodatabases
  • A crime dashboard
  • Building a crime database
  • Creating the tables
  • Populating the data
  • Mapping queries.
  • Incidents by date
  • Incidents in a polygon
  • Buffers
  • Nearest neighbor
  • Interactive widgets
  • Charts
  • Triggers
  • Summary
  • Chapter 8: Automating QGIS Analysis
  • Working in the Python console
  • Loading layers
  • Processing a layer
  • Layer properties
  • Feature properties
  • Drawing a layer from PostGIS
  • Drawing points
  • Drawing polygons from PostGIS
  • Adding, editing, and deleting features
  • Adding features to an existing layer
  • Deleting features from an existing layer
  • Editing features from an existing layer
  • Selecting features using expressions
  • Using toolboxes in Python
  • Writing custom toolboxes
  • Summary
  • Chapter 9: ArcGIS API for Python and ArcGIS Online
  • Introducing the ArcGIS API for Python and ArcGIS Online
  • A Pythonic web API
  • Installing the API
  • Testing the API
  • Troubleshooting
  • Authenticating your Esri user accounts
  • Different Esri user accounts
  • Different modules of the ArcGIS API for Python
  • Exercise 1 - importing the API and using the map widget
  • Creating a personalized ArcGIS Online account
  • Exercise 2 - searching, displaying, and describing geospatial content
  • Exercise 3 - working with raster data and the API's geoprocessing functions
  • Summary
  • Chapter 10: Geoprocessing with a GPU Database
  • Cloud geodatabase solutions
  • Big data processing
  • MapD architecture
  • Cloud versus local versus combined
  • Creating a MapD instance in the cloud
  • Finding the AMI
  • Opening an AWS account
  • Creating a key pair
  • Launching an instance
  • Picking a version
  • Searching for an instance
  • Setting up a security group
  • Immerse environment
  • Logging in to Immerse
  • Default dashboards
  • NYC taxi dataset
  • Importing a CSV
  • Creating a chart
  • Selections with the SQL EDITOR
  • Use geospatial data
  • Connecting to the database using a terminal
  • PuTTYgen.
  • Connection configuration
  • Using the private key
  • Installing pymapd
  • The conda install command
  • The pip install command
  • Creating a connection
  • User and password
  • Data cursor
  • Creating a table
  • Insert statements
  • Using Apache Arrow to load data
  • Contains queries
  • Other available spatial SQL commands
  • Summary
  • Chapter 11: Flask and GeoAlchemy2
  • Flask and its component modules
  • Setup
  • Installing modules using pip
  • Installing Flask using pip
  • Installing Flask-SQLAlchemy via pip
  • Installing GeoAlchemy2 using pip
  • Installing Flask-WTForms and WTForms using pip
  • Installing psycopg2 using pip
  • Installing SQLAlchemy-Utils using pip
  • Installing pyshapefile (or pyshp) using pip
  • Installing pygeoif using pip
  • Writing a Flask application
  • Downloading the data from a data source
  • County, district, state, and arena shapefiles
  • Creating the database and data tables
  • Adding the PostGIS extension tables to the new database
  • Defining the database tables
  • The declarative base
  • Database table model classes
  • Table properties
  • Creating the tables
  • Inserting data into the new data tables
  • Importing the required modules
  • Locating and reading the shapefiles
  • Accessing shapefile data
  • Using queries
  • Components of the Flask application
  • Folder structure and the controller object
  • Models
  • Forms
  • Views
  • Dissecting the view
  • Using forms
  • Evaluating the request method
  • POST requests
  • Spatial queries
  • Relationship query
  • The web map template
  • Running the web application locally
  • Summary
  • Chapter 12: GeoDjango
  • Installing and configuring Django and GeoDjango
  • Steps from Django to GeoDjango
  • Installing Django
  • Installing PostGIS and psycopg2
  • Creating the database
  • GDAL/OGR
  • Modifying Windows environment variables
  • Creating a project and application.
  • Command-line argument - startproject
  • What is created by startproject?
  • Creating an application using manage.py
  • What is created by manage.py
  • Configuring settings.py
  • Adding a new database connection
  • Adding new installed apps
  • Creating the application
  • manage.py
  • Generating data models
  • Multipolygons
  • Database migrations
  • makemigrations
  • sqlmigrate
  • migrate
  • LayerMapping
  • Running the layer mapping
  • Administrative panel
  • GeoDjango administrative panel
  • admin.py
  • createsuperuser
  • runserver
  • URLs
  • URL patterns
  • Views
  • Required folders and files
  • forms.py
  • templates folder
  • Writing views
  • index view
  • queryarena function
  • arena view
  • Running the application
  • Summary
  • Chapter 13: Geospatial REST API
  • Writing a REST API in Python
  • REST
  • JSON
  • Python for REST API
  • Flask
  • REST modules
  • Other frameworks
  • Variables in Flask URLs
  • Number converters
  • Other data converters
  • Request methods
  • GET
  • POST
  • Other available request methods
  • PUT
  • DELETE
  • The REST API application
  • Application components
  • Application folder and file structure
  • app.py
  • __init__.py
  • The database
  • models.py
  • Importing required modules
  • Declaring the session
  • Declaring the models
  • forms.py
  • views.py
  • Importing modules
  • Base URL
  • Arenas
  • Getting all arenas
  • Getting arenas by ID
  • Getting arenas by name
  • A geospatial query
  • States
  • Getting all states
  • Getting a state by ID
  • Getting a state by name
  • Getting arenas by state
  • Counties
  • Getting a county by ID
  • Getting a county by name
  • Districts
  • Getting all districts
  • Getting a district by ID
  • Getting a district by name
  • API POST endpoints
  • New arenas
  • The view function
  • The addarena.html head
  • The addarena.html script
  • The addarena.html form.
  • Sending a POST request using the requests library.