Simple embeddable maps for visualising a feature on a suitable basemap.
Note: This project is focused on needs within the British Antarctic Survey. It has been open-sourced in case it is of interest to others. Some resources, indicated with a '🛡' or '🔒' symbol, can only be accessed by BAS staff or project members respectively. Contact the Project Maintainer to request access.
This project provides a service for applications to embed simple maps of a single feature's geometry.
- maps are embedded via an iframe and the feature geometry is set via a
geom
query string parameter - maps use a basemap based on the feature geometry (i.e. if in the Antarctic, an Antarctic basemap)
- maps use fixed and minimal map controls and feature symbology
- where a geometry is known to give a poor result (such as a bounding box covering Antarctica), a densified polygon will be substituted automatically
The initial version of this service:
- has very limited support for a fixed set of geometries only
- is intended for use in the ADD Metadata Toolbox 🛡️ only
For an Antarctic map:
<iframe src="https://embedded-maps.data.bas.ac.uk/v1/?geom=%5B%5B%5B-180%2C%20-90%5D%2C%5B180%2C%20-90%5D%2C%5B180%2C%20-60%5D%2C%5B-180%2C%20-60%5D%2C%5B-180%2C%20-90%5D%5D%5D" style="border:none;"></iframe>
For a sub-Antarctic map:
<iframe src="https://embedded-maps.data.bas.ac.uk/v1/?geom=geom=%5B%5B%5B-180%2C-60%5D%2C%5B180%2C-60%5D%2C%5B180%2C-50%5D%2C%5B-180%2C-50%5D%2C%5B-180%2C-60%5D%5D%5D" style="border:none;"></iframe>
Note: Requests for any other geometries will return a null response (grey square).
A very simple placeholder app is used to parse the geometry query string value and use this to set the href of an
<img>
element. I.e. if the geom matches the Well Known Extent for Antarctica, the href to an
image of map with the relevant extent shown is used.
public/index.html
acts as the app entry point and template. public/assets/js/main.js
contains all logic, including
locally defined Well Known Extents.
This service uses basemaps as determined by MAGIC/esri#86 🛡️.
Well Known Regions represent commonly referenced and understood areas of the world.
Supported regions are currently defined indirectly via their extents locally within public/assets/js/main.js
.
Well Known Extents represent commonly (if not officially) agreed upon bounding extents for Well Known Regions. They consist of a bounding box expressed as a GeoJSON formatted geometry.
Supported extents are currently defined locally within public/assets/js/main.js
.
Terraform resources are defined in provisioning/terraform/
.
Access to the BAS AWS account 🛡️ is required to provision these resources. Docker and Docker Compose are recommended but not required for running Terraform.
$ cd provisioning/terraform
$ docker compose run terraform
$ terraform init
$ terraform ...
State information for this project is stored remotely using a Backend.
Specifically the AWS S3 backend as part of the BAS Terraform Remote State 🛡️ project.
Remote state storage will be automatically initialised when running terraform init
. Any changes to remote state will
be automatically saved to the remote backend, there is no need to push or pull changes.
Permission to read and/or write remote state information for this project is restricted to authorised users. Contact the BAS Web & Applications Team to request access.
See the BAS Terraform Remote State 🛡️ project for how these permissions to remote state are enforced.
$ python -m http.server 9000 --directory public
A simple page embedding maps for each supported Well Known Extent is provided for manual testing:
tests/local-dev.html
(for local development)tests/integration.html
(for integration/testing)tests/production.html
(for production)
To test an environment locally:
- run the app running locally
- in a separate terminal, run
python -m http.server 9001 --directory tests
- visit: http://localhost:9001/{environment}
For remote testing, visit:
- https://embedded-maps-testing.data.bas.ac.uk/tests/v1/integration.html
- https://embedded-maps.data.bas.ac.uk/tests/v1/production.html
$ENDPOINT/meta/health.json
provides service health information formatted according to the
api-health-check specification. This endpoint should be used to monitor
the health of this service.
The application will be automatically deployed to S3 using Continuous Deployment.
A Continuous Deployment process using GitLab's CI/CD platform is configured in .gitlab-ci.yml
.
British Antarctic Survey (BAS) Mapping and Geographic Information Centre (MAGIC). Contact [email protected].
The project lead is @felnne.
Copyright (c) 2024 UK Research and Innovation (UKRI), British Antarctic Survey (BAS).
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.