Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div id="overlay" class="wrld-widget-container"></div>
<div id="map"></div>
            
          
!
            
              html, body, #map
{
  height: 100%; margin: 0;
}

.eegeo-indoor-control { float: right }
            
          
!
            
              var wrldApiKey = "7bcdc50bec73f1da7fe4fc488fc7fd70";
var laxLocation = L.latLng([33.943398, -118.409541]);


// Create the map
var map = L.Wrld.map(
  "map",
  wrldApiKey,
  {
    center: laxLocation,
    zoom: 17,
    indoorsEnabled: true
  }
);


// Add a control to change between indoor map floors
var indoorControl = new WrldIndoorControl("overlay", map);


// Add a search bar with the following menu items
var searchCategories = [
  { name: "General", searchTag: "general", iconKey: "general" },
  { name: "Check In", searchTag: "check_in", iconKey: "ticket" },
  { name: "Gates", searchTag: "gate", iconKey: "airport" },
  { name: "Coffee", searchTag: "coffee", iconKey: "coffee" },
  { name: "Food & Drink", searchTag: "food_drink", iconKey: "food_drink" },
  { name: "Shopping", searchTag: "shopping", iconKey: "shopping" }
];

var searchbar = new WrldSearchbar("overlay", map, {
  apiKey: wrldApiKey,
  outdoorSearchMenuItems: searchCategories,
  indoorSearchMenuItems: searchCategories
});


// Add a marker controller to draw styled markers on the map
var markerController = new WrldMarkerController(map, { searchbar: searchbar });


// Find a route when a search result is selected
searchbar.on("searchresultselect", selectSearchResult);

function selectSearchResult(event) {
  var location = event.result.location;
  
  var resultCoord = location.latLng;
  var resultFloorId = location.floorIndex;
  
  var coordWithFloor = [resultCoord.lng, resultCoord.lat, resultFloorId];
  var myCoordWithFloor = [myLocation.lng, myLocation.lat, 1];
  
  map.routes.getRoute([myCoordWithFloor, coordWithFloor], displayRoute);
}


// Add a layer group to contain our route polylines
var routeLines = L.layerGroup();
routeLines.addTo(map);


// Indicate our current location with a circle
var laxIndoorMapId = "98a265e2-b890-4c6b-a28f-948c92e36914";
var myLocation = L.latLng([33.94274810771653, -118.40823555904284]);

L.circle(
  myLocation,
  {
    radius: 2.0,
    color: "#0000ff",
    indoorMapId: laxIndoorMapId,
    indoorMapFloorId: 1
  }
).addTo(map);


// Draw polylines representing a route
function displayRoute(routes) {
  routeLines.clearLayers();
  
  for (var i = 0; i < routes[0].length; ++i) {
    var step = routes[0][i];
    var polyline = L.polyline(step.points, { indoorMapId: step.indoorMapId,  indoorMapFloorId: step.indoorMapFloorId });
    polyline.addTo(routeLines);
  }
}

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console