Skip to main content

betaThis is a new capability. Help us improve it and give your feedback on Slack.

Geospatial Field

Composite location picker supporting multiple geospatial coordinate formats.

This component renders an inline Ordnance Survey map that lets users click a location to auto-populate the coordinate inputs across multiple coordinate formats. The map requires the ordnanceSurveyApiKey and ordnanceSurveyApiSecret plugin options to be set — without them the component falls back to plain text inputs.

Warning

Requires client-side JavaScript

This component cannot be previewed here — it requires Ordnance Survey API credentials and a running map service that aren't available in the documentation environment.

A multiline text input that accepts raw GeoJSON is available as a fallback when JavaScript is unavailable, but this is not a recommended user journey. This component has a hard client-side JavaScript requirement. If JavaScript availability is a concern, use a progressively enhanced component instead.

We recommend using the map question pattern when asking users to select or draw locations on a map. This pattern provides alternatives so users who cannot use maps are not excluded.

To see the full experience, view our demo form which includes most components.

JSON definition

{
"type": "GeospatialField",
"name": "fieldName",
"title": "Question title",
"hint": "",
"shortDescription": "",
"options": {}
}

Properties

PropertyTypeRequiredDescription
hintstringNoHint text displayed below the field label to help the user answer the question.
shortDescriptionstringNoA short description of the field used in the check-your-answers summary.

Options

PropertyTypeRequiredDescription
classesstringNoAdditional CSS classes applied to the component.
conditionstringNoName of a condition that controls whether this component is shown.
countriesGeospatialFieldOptionsCountry[]No
customValidationMessagesobjectNoA map of Joi error codes to custom error messages.
instructionTextstringNoAlternative text read by screen readers in place of the field title.
optionalTextbooleanNoWhen true, appends '(optional)' to the field label.
requiredbooleanNoWhether the field must be filled in. Defaults to true.