OPM-Leaflet
Leaflet plugin to handle OpenPlanetaryMap (OPM) basemaps. OPM datasets may be added in the future.
Setting Up
- Include Leaflet JavaScript and CSS (either a hosted or downloaded version).
- Initialise a map.
- Include the file
OPMBasemaps.js
before the map initialisation script; this contains the main OPM basemaps. - Include the file
OPMLayers.js
after the map initialisation script; this contains customisation options. - To change the initial basemaps / overlay, add the layers to the map in
OPMLayers.js
. All OPM layer names are listed below:-
basemapOPMVector
(OPM Vector) -
basemapTexture
(Shaded Mars Surface Texture) -
basemapMOLAGrey
(Shaded Grayscale MOLA Elevation) -
basemapMOLAColor
(Shaded Colour MOLA Elevation) -
basemapViking
(Global Viking MDIM2.1 Colorized Mosaic) -
basemapHillshade
(Global Hillshade) -
overlay
(Labels)
-
Example
See below for example implementation. A working example can be found in the /examples
folder, also at openplanetary.co/opm-leaflet.
<!-- Leaflet JS and CSS -->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.2.0/dist/leaflet.css">
<script src="https://unpkg.com/leaflet@1.2.0/dist/leaflet.js"></script>
<!-- OPM Plugin basemaps -->
<script src="src/OPMBasemaps.js"></script>
<!-- Initialise map -->
<script>
const map = L.map('map', {
center: [0, 0],
maxBounds: [
[-90, -Infinity],
[90, Infinity],
],
maxBoundsViscosity: 0.5
}).setView([11.8, -45.04], 3);
</script>
<!-- OPM Plugin layer options -->
<script src="src/OPMLayers.js"></script>