OrdnanceSurvey / os-data-hub-tutorials

Step-by-step guides to get your project up and running. Here you'll find out how we develop solutions with our APIs. You can follow our step-by-step guides to start building your own innovative projects. These tutorials are related to the Mapping and Data APIs available from our Data Hub (https://osdatahub.os.uk/).
Other
23 stars 7 forks source link

How to get building heights from 3d TopographicArea Building layer? #16

Open eabase opened 2 years ago

eabase commented 2 years ago

How can I access the 3d attribute for building height, RelHMax:

    map.on('style.load', function() {
        // Duplicate 'OS/TopographicArea_2/Building/1' layer to extrude the buildings
        // in 3D using the Building Height Attribute (RelHMax) value.

I only want to get the building height for a particular grid location or TOID/UPRN, so I don't need to plot anything else on a map. How can this be done using any of the OS products?

tmnnrs commented 2 years ago

Hi @eabase. You can also obtain the building height attribution from the OS Features API. Here are a couple of code examples which demonstrate how you could achieve this:

Alternatively you could use something like vector-tile-query. This repo is no longer maintained; but should allow you to query the attribution directly from the vector tiles.

eabase commented 1 year ago

Hi @tmnnrs Thank you for the reply. However, I cannot find any reference to building height in any of those examples. Perhaps you can briefly explain how this could be done, using those examples?

tmnnrs commented 1 year ago

Hello @eabase

These examples have been configured to return only a limited set of the available attributes for the TopographicAreas (in this case TOID + DescriptiveGroup + SHAPE) through use of the propertyName query parameter.

Excluding this parameter will result in the full set of attributes (including those for the building heights) being returned.

You can return a description of the attributes for each feature type supported by the WFS service by performing a DescribeFeatureType request: https://api.os.uk/features/v1/wfs?service=wfs&version=2.0.0&request=DescribeFeatureType&key=.