万本电子书0元读

万本电子书0元读

顶部广告

Mastering Geospatial Analysis with Python电子书

售       价:¥

0人正在读 | 0人评论 9.8

作       者:Silas Toms,Eric van Rees,Paul Crickard

出  版  社:Packt Publishing

出版时间:2018-04-27

字       数:47.7万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Explore GIS processing and learn to work with various tools and libraries in Python. About This Book ? Analyze and process geospatial data using Python libraries such as; Anaconda, GeoPandas ? Leverage new ArcGIS API to process geospatial data for the cloud. ? Explore various Python geospatial web and machine learning frameworks. Who This Book Is For The audience for this book includes students, developers, and geospatial professionals who need a reference book that covers GIS data management, analysis, and automation techniques with code libraries built in Python 3. What You Will Learn ? Manage code libraries and abstract geospatial analysis techniques using Python 3. ? Explore popular code libraries that perform specific tasks for geospatial analysis. ? Utilize code libraries for data conversion, data management, web maps, and REST API creation. ? Learn techniques related to processing geospatial data in the cloud. ? Leverage features of Python 3 with geospatial databases such as PostGIS, SQL Server, and SpatiaLite. In Detail Python comes with a host of open source libraries and tools that help you work on professional geoprocessing tasks without investing in expensive tools. This book will introduce Python developers, both new and experienced, to a variety of new code libraries that have been developed to perform geospatial analysis, statistical analysis, and data management. This book will use examples and code snippets that will help explain how Python 3 differs from Python 2, and how these new code libraries can be used to solve age-old problems in geospatial analysis. You will begin by understanding what geoprocessing is and explore the tools and libraries that Python 3 offers. You will then learn to use Python code libraries to read and write geospatial data. You will then learn to perform geospatial queries within databases and learn PyQGIS to automate analysis within the QGIS mapping suite. Moving forward, you will explore the newly released ArcGIS API for Python and ArcGIS Online to perform geospatial analysis and create ArcGIS Online web maps. Further, you will deep dive into Python Geospatial web frameworks and learn to create a geospatial REST API. Style and approach The book takes a practical, example-driven approach to teach you GIS analysis and automation techniques with Python 3.
目录展开

Title Page

Copyright and Credits

Mastering Geospatial Analysis with Python

Packt Upsell

Why subscribe?

PacktPub.com

Contributors

About the authors

About the reviewer

Packt is searching for authors like you

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Download the color images

Conventions used

Get in touch

Reviews

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

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

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

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

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

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

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

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

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

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

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

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

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

Deleting an arena

Running the REST API locally

Deploying Flask to IIS

Flask and web servers

WSGI

Installing the WFastCGI module and FastCGI

Configuring FastCGI

Root server settings and Environment Variables

Summary

Cloud Geodatabase Analysis and Visualization

How to install CARTOframes

Additional resources

Jupyter Notebooks

The CARTO API key

Package dependencies

The CARTO Data Observatory

Signing up for a CARTO account

A free trial of CARTO

Adding a dataset

The API key

Adding a dataset

Virtual environments

Installing virtualenv

Running virtualenv

Activating the virtual environment

Installing modules in virtualenv

Modules to use

Using Jupyter Notebook

Connecting to an account

Saving credentials

Accessing a dataset

Selecting individual rows

Loading a CSV dataset

Loading a shapefile

Installing GeoPandas

Writing to CARTO

Loading CSV with geometry

Geospatial analysis

Editing and updating datasets

overwrite=True

Creating a map

Summary

Automating Cloud Cartography

All things cartographic

How to integrate Mapbox into your GIS

Mapbox tools

MapboxGL.js

Mapbox Python SDK

Installing the Python SDK

Getting started with Mapbox

Signing up for a Mapbox account

Creating an API token

Adding data to a Mapbox account

Tilesets

Datasets

Example – uploading a GeoJSON dataset

Example – uploading data as a tileset

Mapbox Studio

Customizing a basemap

Adding a tileset

Virtual environment

Installing MapboxGL – Jupyter

Installing Jupyter Notebooks

Installing Pandas and GeoPandas

Using the Jupyter Notebook server

Importing data using GeoPandas

Creating point data from polygons

Data cleanup

Saving the points as GeoJSON

Adding the points to a map

Creating a graduated color visualization

Automatically setting colors, sizes, and breaks

Creating a choropleth map

Saving the map

Creating a heat map

Uploading data using the Mapbox Python SDK

Creating the dataset

Loading the data into the dataset

Reading data from a dataset

Deleting a row

Summary

Python Geoprocessing with Hadoop

What is Hadoop?

Installing the Hadoop framework

Installing Linux

Installing Docker

Install Hortonworks

Hadoop basics

Connecting via Secure Shell

Ambari

Esri GIS tools for Hadoop

HDFS and Hive in Python

Summary

Other Books You May Enjoy

Leave a review - let other readers know what you think

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部