BRC Atlas library
The BRC Atlas library is a Javascript library for providing both easy and flexible APIs for creating static and slippy maps for atlas projects. In fact there are two libraries packaged in one project - one for British atlas mapping (brcatlas.umd.js
) and one for European atlas mapping (brcatlas_e.umd.js
).
Installing
You can get the javscript amd css builds from the GitHub repo or include them in code directly from a CDN, e.g:
<script src="https://cdn.jsdelivr.net/gh/biologicalrecordscentre/brc-atlas/dist/brcatlas.umd.js"></script>
or a minified version generated by the CDN:
<script src="https://cdn.jsdelivr.net/gh/biologicalrecordscentre/brc-atlas/dist/brcatlas.umd.min.js"></script>
You will also need to inlcude the associated CSS, e.g:
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/biologicalrecordscentre/brc-atlas/dist/brcatlas.umd.css">
or a minified version generated by the CDN:
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/biologicalrecordscentre/brc-atlas/dist/brcatlas.umd.min.css">
The CDN also exposes some geojson assets. These are used internally by the mapping libraries, but can be used independently. They include:
- An outline map of Britain, Ireland and the Channel islands. These polygons are at a coarse scale - suitable for using with the static map. (
https://cdn.jsdelivr.net/gh/biologicalrecordscentre/brc-atlas/assets/GB-I-CI-27700-reduced.geojson
). - British & Irish 100 km grid lines. These lines are at a coarse scale - suitable for using with the static map. (
https://cdn.jsdelivr.net/gh/biologicalrecordscentre/brc-atlas/assets/GB-I-grid-27700-reduced.geojson
). - Brtish & Irish country boudaries. These lines are at a coarse scale - suitable for using with the static map. (
https://cdn.jsdelivr.net/gh/biologicalrecordscentre/brc-atlas/assets/GB-I-countries-27700-reduced.geojson
). - Brtish & Irish vice county boundaries. These polygons are at a coarse scale - suitable for using with the static map. (
https://cdn.jsdelivr.net/gh/biologicalrecordscentre/brc-atlas/assets/GB-I-vcs-27700-reduced.geojson
). - A range of geojson country and vice county boundary outlines in the folders
https://cdn.jsdelivr.net/gh/biologicalrecordscentre/brc-atlas/assets/country
andhttps://cdn.jsdelivr.net/gh/biologicalrecordscentre/brc-atlas/assets/vc
. These are defined at a number of scales suitable for different zoom levels on the slippy map. For more information, see README for country assets and README for vice county assets.
API documentation and code examples
For details of the API, view the JSDoc API documentation.
There are also a number of working examples.
Notes for developers
Typical build & publish workflow
npm audit --omit=dev
(look for any important vulnerabilities)npm run lint
npm run docs
- Update the version number in
package.json
- Ensure that
src/constants.hs
&src_e/e_constants.js
are set up correctly (i.e. for production - not development) npm run build
(after package update so that correct version is printed to console by library)- Update
docs/Readme
(if required, e.g. to link new examples) - Git add any new files
git commit
- Git tag <version>, e.g.
git tag 1.2.1
. Tag must match version number in package (to ensure that version can be used to target it in CDN) - Git push origin
, e.g. git push origin 1.2.1
(pushes the tag commit) git push
(pushes to master branch)- Run the following links to purge the jsdelivr CDN caches
- https://purge.jsdelivr.net/gh/biologicalrecordscentre/brc-atlas@latest/dist/brcatlas.umd.js
- https://purge.jsdelivr.net/gh/biologicalrecordscentre/brc-atlas@latest/dist/brcatlas.umd.css