Skip to Content
Python 用于地理空间数据分析
book

Python 用于地理空间数据分析

by Bonny P. McClain
May 2025
Intermediate to advanced
282 pages
4h 2m
Chinese
O'Reilly Media, Inc.
Content preview from Python 用于地理空间数据分析

第 6 章 ArcGIS Python API ArcGIS Python API

本作品已使用人工智能进行翻译。欢迎您提供反馈和意见:translation-feedback@oreilly.com

全球领先的 GIS 公司 Esri 开发的客户端软件和 GIS 套件被称为 ArcGIS。 它集 API 和 Python 软件包于一体,允许用户查询 ArcGIS Online 或 ArcGIS Enterprise 中托管的信息。虽然它不是开源的,但 Esri 在行业中的领导地位已经产生了相当多的免费内容和教程,您可以访问和探索。我将分享一些学习资源、可访问的工具和信息,您可以使用 ArcGIS Python API 访问它们。您需要使用 Jupyter Notebook 和 ArcGIS Online 来跟进学习。

设置

有一个名为 ArcGIS Pro 的桌面应用程序以及一个名为 ArcGIS Online 的基于浏览器的平台;在本章中,您将通过 ArcGIS Python API 使用 ArcGIS Online。

ArcGIS Python API 中可用的模块

为了扩展标准 Python 库,ArcGIS Python API 允许访问额外的模块,这些模块通过点符号提供。您可以在文档中探索这些模块,我将在编码中使用它们时提供更多信息。这些模块包括

Arcgis.gis
连接到 ArcGIS Online
Arcgis.features
提供处理地理要素组的功能
Arcgis.geometry
允许输入和输出不同的几何图形(例如点或多边形)
Arcgis.geocoding
为地图可视化指定位置坐标
Arcgis.geoenrichment
为区域添加属性

在传授地理空间技能时,我使用开源或低成本方案,让尽可能多的人都能获得这些知识。由于大多数 Esri 用户都是专业或企业用户,很少有人了解个人使用的成本负担。无论您选择哪种方式,在使用前请仔细阅读相关文档,以避免产生意想不到的费用。

ArcGIS API 以软件包 arcgis 的形式发布。在下面的示例中,您将通过 Conda(建议的协议)安装它,就像您在本书迄今为止的几个章节中所做的那样。

安装 ArcGIS Pro

尽管 ArcGIS Pro 仅适用于 Windows,但 API 可让非 Windows 用户访问 ArcGIS 功能,而无需打开 Windows 环境。我假设,如果您已经拥有完整的 ArcGIS Pro 许可证,就可以按照文档安装Python Package Manager 或 Python Command Prompt。要使用 Pro 许可证并在桌面环境中使用 API,您需要在运行命令的同一台计算机上安装 ArcGIS。

提示

如果您和我一样拥有 ArcGIS Pro 账户,但更喜欢在 MacOS 中工作,那么您可以离线使用 ArcGIS Pro。 为此,请登录您的 ArcGIS Pro 账户,在 "设置">>"许可证 "中勾选允许您脱机工作的复选框。

即使没有许可证,也有访问公开资源的选项,让我们来探讨一下。

设置环境

接下来,打开终端。我建议创建一个用于下载 ArcGIS 的环境。(你可能还记得,环境允许你安装兼容版本的软件包)。在这里,我将我的环境称为esriENV

提示

虽然可以更新环境中的单个软件包,但如果我在环境中工作时产生了持续性错误,我就会删除整个环境,然后从头开始重新创建。下面是一个新的 Python 地理空间软件包,其中包含常用的软件包,您可以考虑将其添加到任何创建的空间中: ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

实用 Linux 系统管理

实用 Linux 系统管理

Kenneth Hess
ppk on JavaScript

ppk on JavaScript

Peter-Paul Koch
高效R语言编程

高效R语言编程

Colin Gillespie, Robin Lovelace

Publisher Resources

ISBN: 9798341659025