python - 从 ONS 开放地理门户自动获取最新版本的 Shapefile
问题描述
我正在尝试在 Python 中自动化数据管道。
目前,我从以下位置手动下载地方当局地区英国 BUC shapefile的最新版本:https ://geoportal.statistics.gov.uk/datasets/local-authority-districts-december-2020-uk-buc?geometry=-39.021% 2C51.099%2C34.148%2C59.780并用 Geopandas 打开它。
我可以使用以下方法通过 API Explorer 获得相同的 shapefile:
import pandas as pd
import geopandas as gpd
import requests
import json
data = requests.get("https://opendata.arcgis.com/datasets/69dc11c7386943b4ad8893c45648b1e1_0.geojson")
lad_gdf = gpd.GeoDataFrame.from_features(data.json(),crs=4326)
lad_gdf.head()
OUT:
geometry OBJECTID LAD20CD LAD20NM ... LONG LAT Shape__Area Shape__Length
0 POLYGON ((-1.24224 54.72297, -1.24194 54.72272... 1 E06000001 Hartlepool ... -1.27018 54.676140 9.602987e+07 51065.295913
1 POLYGON ((-1.19860 54.58287, -1.16664 54.55423... 2 E06000002 Middlesbrough ... -1.21099 54.544670 5.523139e+07 35500.386745
2 POLYGON ((-0.79189 54.55824, -0.80042 54.55101... 3 E06000003 Redcar and Cleveland ... -1.00608 54.567520 2.483428e+08 78449.389240
3 POLYGON ((-1.19319 54.62905, -1.20018 54.62350... 4 E06000004 Stockton-on-Tees ... -1.30664 54.556911 2.052314e+08 87566.566061
4 POLYGON ((-1.43836 54.59508, -1.42333 54.60313... 5 E06000005 Darlington ... -1.56835 54.535339 1.988128e+08 91926.839545
[5 rows x 11 columns]
我找不到上述 api 的版本,它总是会下载 shapefile 的最新版本,而不是 2020 年 12 月的版本。
有没有办法确保我始终下载最新版本?
谢谢
解决方案
推荐阅读
- android - 如何从firebase而不是硬代码中提取值
- javascript - 如何将道具传递给事件处理程序
- python - 我可以更改 Python Treeview 中单个列的前景色吗?
- gradle - Gradle 5 是否与 Groovy @Field 注释兼容?
- mongodb - MongoDB集合速记?
- linux - Docker volume not storing entire Data
- javascript - 为什么字符串为后增量(something++)与添加 1(something = something +1)产生不同的输出?
- sql - SQL连接3个格式相同的表
- android - 在服务 onTaskRemoved 中调用时,Android 活动不会持续启动
- powershell - 使用 sAMAccountname 从 Get-ADUser 过滤结果