Adding a Wrld polyline indoors
Enter the Intercontinental Hotel and move up one floor to view the polyline.
<!DOCTYPE HTML>
<html>
<head>
<script src="https://unpkg.com/wrld.js@1.x.x"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.1/leaflet.css" rel="stylesheet" />
<style>
#floorButtons {
position: absolute;
z-index: 20;
}
#floorButtons button {
display: block;
width: 100%;
}
</style>
</head>
<body>
<div style="position: relative">
<div id="floorButtons">
<button type="button" onclick="moveUp()">Move Up</button>
<button type="button" onclick="moveDown()">Move Down</button>
<button type="button" onclick="expand()">Expand</button>
<button type="button" onclick="collapse()">Collapse</button>
<button type="button" onclick="exitIndoors()">Exit</button>
</div>
<div id="map" style="height: 400px"></div>
<script>
var map = Wrld.map("map", "your_api_key_here", {
center: [37.782084, -122.404578],
zoom: 17,
indoorsEnabled: true
});
var polylinePointsWithElevation = [
[37.781946, -122.405044, 5.0],
[37.781946, -122.405044],
[37.781825, -122.404892],
[37.782095, -122.404542],
[37.782034, -122.404462],
[37.782034, -122.404462, -5.0]
];
var polyline = Wrld.native.polyline(polylinePointsWithElevation, {
indoorMapId: "intercontinental_hotel_8628",
indoorMapFloorId: 1,
weight: 6.0,
color: "#03f"
}).addTo(map);
function moveUp() {
map.indoors.moveUp();
}
function moveDown() {
map.indoors.moveDown();
}
function expand() {
map.indoors.expand();
}
function collapse() {
map.indoors.collapse();
}
function exitIndoors() {
map.indoors.exit();
}
</script>
</div>
</body>
</html>