Read files into ArcGIS Online from the Spatial Hub

2024-06-05


Introduction

Data from the Improvement Service Spatial Hub can be mapped using ArcGIS Online (AGOL). Below are examples showing how this can be achieved using WFS & WMTS pathways.

Web Feature Services (WFS) are a means of accessing geographic data via a file pathway, drawing directly from the Spatial Hub. The advantage of utilising WFS files lies in their ability to fetch data in real-time from the Spatial Hub each time a map is refreshed. This approach is more dynamic compared to using static file types that are downloaded and stored on a local device (such as those in a downloads folder). Static files risk becoming outdated unless the source data is frequently checked and manually updated with the latest versions.

Web Map Tile Services (WMTS) are an international specification for serving digital maps over the web using cached image tiles in a raster format. They enable quicker loading of and navigation around a map or image than a direct download of static raster data. As with a WFS, they are also a dynamic format, ensuring that the source dataset remains the current version.

This guide assumes that the reader has already registered for a Spatial Hub Account. If this is not the case, please see our FAQ ‘How can I access the Spatial Hub?’ and register for a free account here.

This guide also assumes the user has an AGOL account.

Co-ordinate Reference Systems

All Spatial Hub datasets are provided in the OSGB 1936 / British National Grid (EPSG:27700) CRS, so please ensure that your AGOL project is using the same CRS, otherwise datasets may display inaccurately.

Reading Shapefiles

Shapefiles are available for each dataset on the Spatial Hub.

On https://data.spatialhub.scot/ log in and navigate to your chosen dataset, it is essential that you are logged into your account at this stage, otherwise you will not be able to download the data.

This guide uses the ‘Air Quality Management Areas – Scotland’ dataset as an example:

Clicking the ‘Download’ button opens a drop-down menu offering a choice of Web Services, GeoJSON, Shapefile, or CSV.

Selecting ‘Shapefile’ will open a dialogue box with a dropdown menu offering you a choice of layers to download – most datasets only comprise one layer but some (i.e., Historic Environment Records) will have more.

Select your layer, click ‘Submit’ and then click ‘Accept and Download’ in the subsequent Terms and Conditions dialogue box. The layer will download as a zip file to your default download location (usually the ‘Downloads’ folder), from there you can copy it across to the source folder for your AGOL project.

This screenshot shows the downloaded ZIP file that you will need to successfully load the shapefile into ArcGIS Pro.

In your AGOL map, select and click ‘Add layer from file’ in the dropdown menu beside the ‘Add’ button:

The ‘Add layer’ dialogue box will open, click the button corresponding to your data source (i.e., if the .zip file is in your Downloads folder, click ‘Your device’:

Navigate to the folder containing your downloaded .zip folder then drag-and-drop the .zip folder into the ‘Add layer’ dialogue box. A summary of the file (name and type) will appear, click ‘Next’, then a dialogue box will open allowing you to make any adjustments to the storage location and metadata that you require:

Make any changes you want, then click ‘Create and add to map’. Your dataset will appear in your AGOL project; visible both on the map and listed in the ‘Layers’ pane.

From here you can interrogate the shapefile using the AGOL tools.

WFS pathways

WFS Pathways are available for the entire Spatial Hub, as well as each individual dataset. This section deals with reading them into AGOL.

Reading WFS Pathways for the Spatial Hub

It is essential that you are logged into your account at this stage, otherwise you will not be able to access your authkey and connect to the web services. On https://data.spatialhub.scot/ log in and navigate to your user profile to retrieve your Geoserver Authkey:

In your AGOL map, select and click ‘Add layer from URL’ in the dropdown menu beside the ‘Add’ button.

Enter “https://geo.spatialhub.scot/geoserver/wfs?authkey=your authkey here” into the ‘URL’ field and select ‘Next’.

Select the layer you want. There is a feature limit of 3000 features, so don’t try to load in the whole dataset if it is large.

Click ‘Add to map’, your dataset will appear in your AGOL project; visible both on the map and listed in the ‘Layers’ pane. From here you can interrogate the shapefile using the AGOL tools.

WMTS Pathways

WMTS Pathways are available for the entire Spatial Hub, as well as each individual dataset. This section deals with reading them into AGOL.

Reading WMTS Pathways for the Spatial Hub

As with the WFS services, it is essential that you are logged into your account at this stage, otherwise you will not be able to access your authkey and connect to the web services.

On https://data.spatialhub.scot/ log in and navigate to your user profile to retrieve your Geoserver Authkey.

For WMTS to work correctly in AGOL follow the initial steps for a WFS connection, and when you are prompted to input a URL in the ‘Add Layer’ dialogue box, enter “https://geo.spatialhub.scot/geoserver/gwc/service/wmts?authkey=your authkey here”.

In addition, select the “Add Custom Parameter” option and then tick the box to “Append only to requests that draw or query layers”:

Click ‘Next’, then select the layer you want from the drop-down menu, making sure that the ‘Matrix tile’ is set as ‘EPSG:27700’:

Click ‘Add to map’, your dataset will appear in your AGOL project; visible both on the map and listed in the ‘Layers’ pane.

From here you can interrogate the shapefile using the AGOL tools.