如何从ArcGIS Online地图抓取数据? [英] How do I scrape data from an ArcGIS Online map?

查看:287
本文介绍了如何从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/content/items/2c9f3e737cbf4f6faf2eb956fa26cdc5/data

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

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

  • d2b4a98c39fd4587b99ac0878c420125
  • 7b1af1752c3a430184fbf7a530b5ec65
  • c6e9d07e4c2749e4bfe23999778a3153
  • d2b4a98c39fd4587b99ac0878c420125
  • 7b1af1752c3a430184fbf7a530b5ec65
  • c6e9d07e4c2749e4bfe23999778a3153

查看这些网络地图中任何一个的商品数据端点:

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

https://www.arcgis.com/sharing/rest/content/items/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

然后只需运行查询,其中where0=0(或您想要的任何值),而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地图抓取数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆