I am trying to automate a data pipeline in Python.
Currently I manually download the latest version of the Local Authority Districts UK BUC shapefile from: https://geoportal.statistics.gov.uk/datasets/local-authority-districts-december-2020-uk-buc?geometry=-39.021%2C51.099%2C34.148%2C59.780 and open it with Geopandas.
I am able to get the same shapefile via the API Explorer using the following:
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]
I can't find a version of the above api that will always download the latest version of the shapefile as opposed to the December 2020 version.
Is there a way to ensure that I always download the newest release?
Thanks