Skip to content

Commit 055bbb5

Browse files
committed
Added Conservation Areas dataset.
1 parent 39a4312 commit 055bbb5

5 files changed

Lines changed: 200 additions & 1 deletion

File tree

conservation_areas/README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<table>
2+
<tr>
3+
<td>Dataset name</td>
4+
<td>Conservation Areas in Trafford</td>
5+
</tr>
6+
<tr>
7+
<td>Dataset description</td>
8+
<td>Conservation Areas in England as designated by Local Planning Authorities and compiled by Historic England. Conservation areas exist to manage and protect the special architectural and historic interest of a place - in other words, the features that make it unique. Every local authority in England has at least one conservation area and there are around 10,000 in England. Most conservation areas are designated by the Council as the local planning authority. In conservation areas there are some extra planning controls and considerations in place to protect the historic and architectural elements which make the place special.</td>
9+
</tr>
10+
<tr>
11+
<td>Source</td>
12+
<td>Historic England</td>
13+
</tr>
14+
<tr>
15+
<td>Publisher</td>
16+
<td>Historic England</td>
17+
</tr>
18+
<tr>
19+
<td>Publisher URL</td>
20+
<td><a href="https://opendata-historicengland.hub.arcgis.com/datasets/historicengland::conservation-areas/about">https://opendata-historicengland.hub.arcgis.com/datasets/historicengland::conservation-areas/about</a></td>
21+
</tr>
22+
<tr>
23+
<td>Geography</td>
24+
<td>Local authority</td>
25+
</tr>
26+
<tr>
27+
<td>Geographic coverage</td>
28+
<td>Trafford</td>
29+
</tr>
30+
<tr>
31+
<td>Temporal coverage</td>
32+
<td>2024-07-24</td>
33+
</tr>
34+
<tr>
35+
<td>Update frequency</td>
36+
<td>Unknown</td>
37+
</tr>
38+
<tr>
39+
<td>Licence</td>
40+
<td><a href="http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/">Open Government Licence</a></td>
41+
</tr>
42+
<tr>
43+
<td>Attribution</td>
44+
<td>&copy; Historic England 2024. Contains Ordnance Survey data &copy; Crown copyright and database right 2024. The Historic England Data contained in this material was obtained on 16-08-2024. The most publicly available up to date Historic England Data can be obtained from <a href='https://historicengland.org.uk' target='_blank'>HistoricEngland.org.uk</a></td>
45+
</tr>
46+
<tr>
47+
<td>Format</td>
48+
<td>CSV, GeoJSON</td>
49+
</tr>
50+
<tr>
51+
<td>Openness rating</td>
52+
<td>&#9733&#9733&#9733&#9734&#9734&nbsp; Structured data in open format (e.g. CSV)</td>
53+
</tr>
54+
<tr>
55+
<td>Last updated</td>
56+
<td>2024-08-16</td>
57+
</tr>
58+
<tr>
59+
<td>Notes</td>
60+
<td></td>
61+
</tr>
62+
<tr>
63+
<td>Lab visualisation</td>
64+
<td>View data within the Lab's <a href="https://www.trafforddatalab.io/explore/#dataset=conservation_areas">Explore application</a>.</td>
65+
</tr>
66+
</table>
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Conservation Areas in Trafford where Trafford Council is the Local Planning Authority (LPA) responsible for the area.
2+
# Created 2024-08-16
3+
# Data updated: 2024-07-24
4+
# Data: https://opendata-historicengland.hub.arcgis.com/datasets/historicengland::conservation-areas/about
5+
# Metadata: https://historicengland.org.uk/listing/the-list/data-downloads
6+
# Licence: Open Government Licence v3 (https://historicengland.org.uk/terms/website-terms-conditions/open-data-hub/)
7+
8+
# NOTES:
9+
# These features are obtained from an ArcGIS API service, similar to that of the ONS Geography Portal.
10+
# The default API call returns features for the whole county, therefore it's best to use some extra parameters, such as defining a rectangle (spatial envelope) around the LA, to reduce the amount of data being returned and speed up the process.
11+
12+
13+
# Required packages ---------
14+
library(tidyverse) ; library(sf) ; library(lubridate)
15+
16+
# =========
17+
# VERY IMPORTANT NOTE REGARDING SF PACKAGE AND COORDINATE WINDING ORDER 2023-12-21:
18+
# The IETF standard for GeoJSON has made certain changes over the original non-IETF specification. The changes can be viewed here: https://datatracker.ietf.org/doc/html/rfc7946#appendix-B
19+
# One key change is that polygon rings MUST follow the right-hand rule for orientation (counter-clockwise external rings, clockwise internal rings).
20+
# This change has caused issues with certain libraries which have historically used the left-hand rule, i.e. clockwise for outer rings and counter-clockwise for interior rings.
21+
# D3-Geo, Vega-Lite and versions of sf below 1.0.0 (default behaviour) use the GEOS library for performing flat-space calculations, known as R^2 (R-squared) which produce polygons wound to the left-hand rule.
22+
# The sf package from version 1.0.0 onwards now uses the S2 library by default which performs S^2 (S-squared) spherical calculations and returns polygons wound according to the right-hand rule.
23+
# At the time of writing, if we want our geography files to work in D3 and Vega-Lite, they must use the left-hand rule and so we need sf to use the GEOS library not S2.
24+
# More information regarding this can be found at: https://r-spatial.github.io/sf/articles/sf7.html#switching-between-s2-and-geos
25+
# =========
26+
sf_vers <- package_version(packageVersion('sf')) # packageVersion returns a character string, package_version converts that into numeric version numbers (major.minor.patch) e.g. 1.0.0
27+
28+
# Only run the following if we are using sf version 1.0.0 or above
29+
if (sf_vers$major >= 1) {
30+
useS2 <- sf_use_s2() # store boolean to indicating if sf is currently using the s2 spherical geometry package for geographical coordinate operations
31+
sf_use_s2(FALSE) # force sf to use R^2 flat space calculations using GEOS which returns polygons with left-hand windings
32+
}
33+
34+
35+
# API parameters specifying the spatial rectangular area containing Trafford
36+
api_geommetry_envelope <- "&geometryType=esriGeometryEnvelope&geometry=%7B%22spatialReference%22%3A%7B%22latestWkid%22%3A3857%2C%22wkid%22%3A102100%7D%2C%22xmin%22%3A-278455.35481123265%2C%22ymin%22%3A7047642.057770884%2C%22xmax%22%3A-244823.0623658004%2C%22ymax%22%3A7073592.428873666%2C%22type%22%3A%22esriGeometryEnvelope%22%7D"
37+
38+
39+
# Local authority district -------------------------
40+
# Source: ONS Open Geography Portal
41+
# URL: https://geoportal.statistics.gov.uk/datasets/ons::local-authority-districts-may-2023-boundaries-uk-bfc/about
42+
# Licence: OGL v3.0
43+
# NOTE: we need the LA boundary stored as an sf object for use in st_intersection() calculations for other boundaries/features
44+
# we use the full resolution version as this ensures any features near the border are included/not included correctly
45+
la <- st_read("https://services1.arcgis.com/ESMARspQHYMw9BZ9/arcgis/rest/services/Local_Authority_Districts_May_2023_UK_BFC_V2/FeatureServer/0/query?outFields=*&where=UPPER(lad23cd)%20like%20%27%25E08000009%25%27&f=geojson") %>%
46+
select(area_code = LAD23CD, area_name = LAD23NM)
47+
48+
49+
# Get the information for items within Trafford -------------------------
50+
df_conservation_areas <- st_read(paste0("https://services-eu1.arcgis.com/ZOdPfBS3aqqDYPUQ/arcgis/rest/services/Conservation_Areas/FeatureServer/1/query?outFields=*&where=1%3D1&f=geojson", api_geommetry_envelope)) %>%
51+
st_intersection(la) %>%
52+
filter(LPA == "Trafford") %>% # This is required as there are 4 conservation areas touching the Trafford boundary which are the responsibility of neighbouring LAs
53+
st_cast('POLYGON', warn=F) # The Ashton upon Mersey area is a multipolygon which causes issues in Explore and Plotter. Checking on the source data map shows no requirement for this to be a multipolygon, so converting to a simple polygon instead.
54+
55+
# Process the dataset, renaming and creating required variables
56+
df_conservation_areas <- df_conservation_areas %>%
57+
rename(site_name = NAME,
58+
site_area_square_metres = Shape__Area,
59+
risk_survey_reference = UID) %>%
60+
mutate(lon = map_dbl(geometry, ~st_centroid(.x)[[1]]), # Calculate the coordinates of the area's centroid as a "lat" and "lon" property
61+
lat = map_dbl(geometry, ~st_centroid(.x)[[2]]),
62+
site_area_square_metres = as.numeric(str_trim(format(site_area_square_metres, nsmall = 2))),
63+
site_area_hectares = format(site_area_square_metres / 10000, nsmall = 2),
64+
designation_date = if_else(DATE_OF_DE == "02/1976", dmy("01/02/1976"), dmy(DATE_OF_DE))) %>%
65+
select(site_name,
66+
site_area_hectares,
67+
site_area_square_metres,
68+
designation_date,
69+
risk_survey_reference,
70+
lon,
71+
lat)
72+
73+
74+
# Create the Conservation Areas files for Trafford -------------------------
75+
st_write(df_conservation_areas, "trafford_conservation_areas.geojson")
76+
77+
df_conservation_areas %>%
78+
st_drop_geometry() %>%
79+
write_csv("trafford_conservation_areas.csv")
80+
81+
82+
# Ensure sf_use_s2() is reset to the state it was in before running the code above, i.e. whether to use the S2 library (for S^2 spherical coordinates) or GEOS (for R^2 flat space coordinates). Only if using v1 or above of the sf package
83+
if (sf_vers$major >= 1) sf_use_s2(useS2)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
site_name,site_area_hectares,site_area_square_metres,designation_date,risk_survey_reference,lon,lat
2+
Ashton upon Mersey, 4.4625455,44625.455,1976-05-04,9014,-2.343639303400225,53.433071381792075
3+
Goose Green, 0.3234115,3234.115,1973-02-04,9023,-2.350211562951662,53.38544092454435
4+
Ashley Heath, 20.6627402,206627.402,1974-07-04,9013,-2.3493824521562736,53.37171558390412
5+
Barton-upon-Irwell, 3.5363129,35363.129,1976-02-01,9015,-2.353342090471862,53.4736051987522
6+
Bowdon, 68.5612192,685612.192,1973-02-06,9016,-2.3590323582335198,53.37746630954767
7+
Brogden Grove, 0.7294362,7294.362,1976-05-04,9017,-2.3302814656595014,53.41960963786397
8+
Dunham Town, 15.7353664,157353.664,1975-07-01,9018,-2.3932261801162853,53.386382506074014
9+
Dunham Woodhouses, 6.6532452,66532.452,1975-07-29,9019,-2.4149138323534056,53.38848799410233
10+
Empress, 6.6672537,66672.537,1995-11-21,9020,-2.2685693511115947,53.4659290693278
11+
Flixton, 3.1020667,31020.667,1975-07-01,9021,-2.3826752684857304,53.44201319213736
12+
George Street, 1.3900414,13900.414,1987-03-12,9022,-2.351042254156471,53.38660948427727
13+
Hale Station, 10.1814940,101814.94,1986-08-14,9024,-2.3477038117310722,53.377868524137725
14+
Linotype Housing Estate, 7.5714461,75714.461,1985-07-04,9025,-2.356983786213128,53.39547516697959
15+
Longford, 28.7845431,287845.431,1996-09-25,9026,-2.2904989877017394,53.44831326515078
16+
Old Market Place, 16.2526971,162526.971,1973-02-08,9028,-2.3522186984883375,53.38886304315118
17+
Sandiway, 3.7462147,37462.147,1975-12-02,9030,-2.352613354967557,53.39287478283016
18+
South Hale,168.2643102,1682643.102,1986-02-25,9031,-2.327393868657985,53.370309915267185
19+
Stamford New Road, 4.7674161,47674.161,1987-06-16,9032,-2.349517750203606,53.38651693254643
20+
Devisdale,141.0022102,1410022.102,1974-07-04,9029,-2.3678108418600328,53.383695273759585
21+
The Downs, 19.6630780,196630.78,1973-02-08,9027,-2.354373418700116,53.383191061793795
22+
Warburton Village, 5.0183899,50183.899,1975-07-29,9033,-2.454849395076066,53.40203601317174

0 commit comments

Comments
 (0)