As the Technical Director at Cadcorp, Martin Daly has written this week’s #OSDeveloper guest blog to share his experience of the new OS Data Hub and desktop GIS…
At Cadcorp, we have, for the best part of 30 years, endeavoured to ensure that our Cadcorp SIS – Spatial Information System® suite of GIS software supports all of the wide variety of Ordnance Survey data products, in all of the wide variety of data supply formats, in as simple and effective a way as possible.
We’ve worked very hard over those years to allow end-users to, for example, drag-and drop file-based data in the format supplied by OS. That capability began all the way back with Land-Line NTF in the 1990s:
These days it extends to the OS MasterMap Topography Layer introduced in the 2000s, and supplied as OGC Geography Markup Language files (loaded here from an original 2001-era sample file):
It was therefore entirely natural for us to add support for the OS Data Hub when it was announced, and entirely natural for us to make it as simple, but powerful, as possible.
The easiest thing for us to have done would have been to piggy-back on the user interface in Cadcorp SIS Desktop for OGC Web Feature Service (WFS, as used by the OS Features API), and OGC Web Map Tile Service (WMTS, as used by the OS Maps API). However, the UI for these is – especially in the case of WFS – quite complex and necessarily technical, which could have easily been a barrier to entry for those not familiar with the terminology and intricacies of OGC W*S standards.
Instead, during the initial OS Data Hub Beta phase, we designed and implemented new UI in SIS Desktop 9.0 to streamline and simplify the user experience for our users, and had it ready for release in a Cadcorp SIS 9.0 service release shortly after the OS Data Hub went live.
The Add Overlay Wizard
The Add Overlay Wizard is the first stop for most SIS Desktop users when adding a new data source to their map, and looks like this:
Note that there is already an Ordnance Survey (GB) category for access to the myriad of OS data sources supported by SIS. Our first step was to add an OS (GB) Data Hub Overlay ‘type’:
Picking this type leads to a choice of the supported APIs – Features, Maps and Vector Tile:
In order to access any of these APIs, an OS Data Hub ‘API Key’ is required. End-users are free to use their own, obtained from the OS Data Hub after a free registration process, but again this seemed like a barrier to entry, and so if no API Key is supplied, SIS Desktop offers one to the user:
Note that the built-in API Key is an OS OpenData Plan one, and therefore only offers access to the free OS Open Data parts of the APIs (albeit unlimited), not a Premium Plan one that includes all of the available data, but incurs a cost after certain ‘transaction’ limits are reached (numbers of features requested, maps viewed, etc).
The OS Features API
Having supplied an API Key, or decided to use the built-in API Key, picking the OS Features API UI is next (shown here with an OS OpenData Plan API Key):
At first glance there does seem to be quite a lot to deal with, but this UI is not only a great deal simpler than that for OGC WFS, but it is also able to present the OS Features API data in a product-oriented way, instead of a feature-oriented one. This brings the familiarity of the OS Data Products to the fore, instead of their constituent Feature Types. For example, picking OS Open Zoomstack from the list of products shows all of the OS Open Zoomstack Feature Types in the list in their suggested drawing order, and by default, selects them all for loading:
Furthermore, because of the product-oriented nature of the UI, the user is able to pick from any of the built-in Themes, derived directly from the OS-supplied stylesheets:
Picking the Outdoor style, and pressing Finish, leads to:
Sadly the maze is gone now: too bad. Zooming out to 1:10,000 shows that only features that overlapped the view in the current map window were loaded from the OS Features API:
Although SIS Desktop does not require the OS Features API requests to be spatially filtered, it is the default. Other options are to have no spatial filter at all, which is only practical for the smaller datasets, e.g. OS Open Zoomstack Airports, or to use a spatial query based on a selected feature from another overlay in the map, e.g. to request all of the OS Open UPRNs within a polygon.
On top of these spatial constraints, the user has to specify an absolute limit on the number of features per Feature Type that are requested: the OS Features API is not intended a replacement for bulk downloads of large datasets (more than 4Gb in the case of OS Open Zoomstack in OGC GeoPackage format).
Repeating the same steps but using a Premium Plan API Key, choosing the OS MasterMap Topography Layer product and the built-in Grayscale Theme (not an OS-supplied style, but a Cadcorp-specific one automatically generated from the Light stylesheets) gives exactly the result that you should now expect (and confirms that the maze is indeed no more):
In order to comply with the OS Data Hub T&Cs Premium Data products can only be cached locally for the duration of a SIS Desktop session. When requesting OS Open Data, SIS Desktop allows the requested data to be imported, breaking the connection to the OS Features API, e.g. to use the data offline.
The OS Maps API
The good news is that the OS Features API is by far the most complex of the three. The OS Maps API user interface could not be simpler:
Simply pick the combination of Style (Light, Outdoor, Road or Leisure) and Coordinate Reference System (British National Grid or Google Maps-like WGS84 / Pseudo Mercator) and hit Finish:
Zooming out to 1:10,000 shows that the data is dynamic:
The OS Vector Tile API
The OS Vector Tile API is similarly simple (shown here with a Premium Plan API Key; the OpenData Plan list is much shorter):
The Basemap (British National Grid) Tileset again confirms that the maze has not grown back while I’ve been writing this post (and that the styles that are built-in to the OS Vector Tile API are applied without the end-user having to apply any additional steps, as per the OS Features API, above):
This time, zooming out to 1:10,000 shows on of the main benefits of vector tiles. Because the retrieved tile data is vector, all of the drawing is on the client side, in SIS Desktop itself, which allows pixel-perfect, anti-aliased (ie smooth-edged) lines, text, etc, for an (arguably) improved backdrop map:
Zooming out further, to 1:100,000, shows that there are a lot of contour lines in south Wales (and that the pixel-perfect drawing is scale-independent):
And finally at 1:1,000,000, very hilly indeed:
This simplicity, and drawing precision, is serendipity at work. We added support for the Mapbox Vector Tile Specification and the related Mapbox Style Specification to Cadcorp SIS 9.0 on a whim, because it looked (in as much as any computer programming can) cool. No end-user had requested it, and no end-user had to pay for it, but every Cadcorp SIS user now benefits from it here, in the OS Vector Tile API, and in support for OS Open Zoomstack in Vector Tiles (MBTiles) format (plus any other OS data products that are released as Vector Tiles in future).
OS Downloads API
Behind the scenes we are also making use of the OS Downloads API. A new build of Cadcorp SIS 9.0 is made every weekday night. Each night, the build ‘scripts’ download the latest OS CodePoint-Open, OS Open UPRN and OS Open USRN data files, process them into filebased databases to be used for geocoding. The OS Open UPRN and Open USRN geocoders were suggested by an end-user on our Cadcorp Community forum, and, thanks to the OS Downloads API, could be implemented a few days later, and then released in the Cadcorp SIS September 2020 Monthly Preview, for later inclusion in the next service release.
I hope that you agree that we’ve made the undoubted power of the OS Data Hub APIs simple to understand and use.
I’ve (politely, as their guest, after all) skimmed over some to-ing and fro-ing during the Beta phase (do not mention the XY versus YX coordinate order thing), but can assure you that all of our requests were handled promptly and respectfully, and with a spirit of cooperation throughout.
OS have invested a great deal of time and effort in the OS Data Hub, and we at Cadcorp have no doubt that it is a practical, sensible and desirable way of delivering OS data, and that it is here to stay.