Adding a Wrld polyline with elevation
Add a Wrld polyline to a map with elevation.
<!DOCTYPE HTML>
<html>
<head>
<script src="https://cdn-webgl.wrld3d.com/wrldjs/dist/latest/wrld.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.1/leaflet.css" rel="stylesheet" />
</head>
<body>
<div style="position: relative">
<div id="map" style="height: 400px"></div>
<script>
var map = L.Wrld.map("map", "your_api_key_here", {
center: [55.942953, -3.161405],
zoom: 15
});
var polylinePoints = [
[55.945976, -3.162339],
[55.943671, -3.158673],
[55.941648, -3.159911],
[55.943248, -3.163275]
];
// Red polyline with altitude offset from terrain height
var polyTerrainLevel = L.Wrld.polyline(polylinePoints, {
elevation: 200,
elevationMode: "heightAboveGround",
color: "#ff0000ff"
}).addTo(map);
// Blue polyline with altitude offset from sea level.
var polySeaLevel = L.Wrld.polyline(polylinePoints, {
elevation: 200,
elevationMode: "heightAboveSeaLevel",
color: "#0000ffff"
}).addTo(map);
</script>
</div>
</body>
</html>