5 使用 Python 处理地理空间数据#

5 Working with Geospatial Data in Python

在本章中,我们将结合之前介绍的Python库和地理空间数据,完成多项任务。这些任务的选择旨在展示如何在Python程序中处理地理空间数据的不同技巧;虽然在某些情况下,可能有更快捷和简便的方法来实现这些结果(例如,使用命令行工具),但我们将在Python中创建这些解决方案,以便您学习如何在自己的Python程序中处理地理空间数据。

本章将涵盖以下内容:

  • 读取和写入矢量和栅格格式的地理空间数据

  • 更改地理空间数据使用的基准面和投影

  • 在Python程序中表示和存储地理空间数据

  • 对点、线和多边形执行地理空间计算

  • 转换和标准化几何和距离的单位

本章的格式类似于一本食谱,详细介绍了您可能想要执行的各种现实任务,并提供了实现这些任务的“食谱”。

In this chapter, we combine the Python libraries and geospatial data covered earlier to accomplish a variety of tasks. These tasks have been chosen to demonstrate various techniques for working with geospatial data in your Python programs; while in some cases there are quicker and easier ways to achieve these results (for example, using command-line utilities), we will create these solutions in Python so you can learn how to work with geospatial data in your own Python programs. This chapter will cover:

  • Reading and writing geospatial data in both vector and raster format

  • Changing the datums and projections used by geospatial data

  • Representing and storing geospatial data within your Python programs

  • Performing geospatial calculations on points, lines, and polygons

  • Converting and standardizing units of geometry and distance

This chapter is formatted like a cookbook, detailing various real-world tasks you might want to perform and providing “recipes” for accomplishing them.