本文介绍了如何从 ArcGIS Online 地图中抓取数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从 ArcGIS 地图中抓取数据.当我们单击红色要素时,以下地图会弹出一个窗口.如何以编程方式访问该数据?

I want to scrape the data from an ArcGIS map. The following map has a popup when we click the red features. How do I access that data programmatically?

链接:https://cslt.maps.arcgis.com/apps/MapSeries/index.html?appid=2c9f3e737cbf4f6faf2eb956fa26cdc5

推荐答案

注意:请尊重您访问的任何 ArcGIS Online 项目的访问和使用限制.如有疑问,请勿保存他人数据的副本.

Note: Please respect the access and use constraints of any ArcGIS Online item you access. When in doubt, don't save a copy of someone else's data.

ArcGIS Online REST 接口使得获取 ArcGIS Online 项目背后的数据变得相对简单.您需要使用可以发出 HTTP 请求和解析 JSON 文本的环境.当前的大多数编程语言要么内置这些功能,要么提供具有这些功能的库.

The ArcGIS Online REST interface makes it relatively simple to get the data behind ArcGIS Online items. You need to use an environment that can make HTTP requests and parse JSON text. Most current programming languages either have these capabilities built in or have libraries available with these capabilities.

这是您的代码可以遵循的一般工作流程.

Here's a general workflow that your code could follow.

  1. 使用应用 ID 和 项目数据端点以查看应用的 JSON 文本:

  1. Use the app ID and the item data endpoint to see the app's JSON text:

https://www.arcgis.com/sharing/rest/内容/项目/2c9f3e737cbf4f6faf2eb956fa26cdc5/data

在该文本中搜索 webmap 并查看应用程序使用以下网络地图:

Search that text for webmap and see that the app uses the following web maps:

  • d2b4a98c39fd4587b99ac0878c420125
  • 7b1af1752c3a430184fbf7a530b5ec65
  • c6e9d07e4c2749e4bfe23999778a3153

查看任何这些网络地图的项目数据端点:

Look at the item data endpoint for any of those web maps:

https://www.arcgis.com/sharing/rest/内容/项目/d2b4a98c39fd4587b99ac0878c420125/data

operationalLayers 列表指定您可以从中收集数据的要素图层 URL.例如:

The list of operationalLayers specifies the feature layer URLs from which you could harvest data. For example:

https://services2.arcgis.com/gWRYLIS16mKUskSO/arcgis/rest/services/VHR_Areas/FeatureServer/0

然后运行一个查询 带有 0=0where(或任何你想要的)和 *outFields:

Then just run a query with a where of 0=0 (or whatever you want) and an outFields of *:

https://services2.arcgis.com/gWRYLIS16mKUskSO/arcgis/rest/services/VHR_Areas/FeatureServer/0/query?where=0%3D0&outFields=%2A&f=json

如果您想查看人类可读的请求表单和结果,请改用 f=html.

Use f=html instead if you want to see a human-readable request form and results.

请注意,要素服务对每个请求可以获得的要素数量有限制,因此您可能希望按几何或属性值进行过滤.阅读文档以了解您所能了解的一切使用要素服务查询.

Note that feature services have a limit of how many features you can get per request, so you will probably want to filter by geometry or attribute values. Read the documentation to learn everything you can do with feature service queries.

这篇关于如何从 ArcGIS Online 地图中抓取数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 05:17