npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

leaflet-indoor-pytek

v1.0.1

Published

Leaflet Indoor =====================

Downloads

86

Readme

Leaflet Indoor

Provides basic tools to create indoor maps with Leaflet.

This plugin provides a layer intended for displaying indoor data (rooms, corridors, ...). It also provides a control component to change the level displayed.

Demo

You can see the demo included in the example directory here.

Using the plugin

See the included example for usage.

Basic Usage

Create a L.Indoor, then add the data to it.

// where data is a GeoJSON feature collection
var indoorLayer = new L.Indoor(data);

// set the initial level to show
indoorLayer.setLevel("0");

indoorLayer.addTo(map);

var levelControl = new L.Control.Level({
    level: "0",
    levels: indoorLayer.getLevels()
});

// Connect the level control to the indoor layer
levelControl.addEventListener("levelchange", indoorLayer.setLevel, indoorLayer);

levelControl.addTo(map);

Usage Instructions

The data should be a GeoJSON feature collection (or an array of GeoJSON features). With the standard configuration, each feature must have a property attribute "level", which can be a integer, string or array of either (or both).

{
    type: "FeatureCollection",
    features: [
        {
            type: "Feature",
            geometry: ...,
            properties: {
                ...
                level: 1
                ....
            }
        },
        {
            type: "Feature",
            geometry: ...,
            properties: {
                ...
                level: [2, 3]
                ....
            }
        }
    ]
}

If the data is not in this format, you can pass in a replacement getLevel function, that will be used to get the level for each Feature.

var indoorLayer = new L.Indoor(data, {
    getLevel: function(feature) {
        return feature.properties.otherLevel;
    }
    onEachFeature

    markerForFeature
});

L.Control.Level is the user interface component that allows for the easy switching of levels. It takes in some levels (which you can get from the indoor layer by using getLevels()), and displays a list.

var levelControl = new L.Control.Level({
    level: "0",
    levels: indoorLayer.getLevels()
});

When using the L.Control.Indoor, if the levels are not integers, by default, the levels will be converted to integers for the ordering in the control. If the levels given to the control are not integers, then the parseLevel option can be used to replace the default function that uses parseInt(level, 10).

var levelControl = new L.Control.Level({
    level: "1A",
    levels: indoorLayer.getLevels()
    parseLevel: function(level) {
        var levels = {
            "1A": 1,
            "1B": 2,
            "1C": 3,
            "2": 4
        };
        return levels[level];
    }
});

You can then bind the "levelchange" event, to change the level displayed by the layer. Note that the levels that the control has must match that used by the layer, if the levels in the control have been set via getLevels), this should be the case.

levelControl.addEventListener("levelchange", indoorLayer.setLevel, indoorLayer);

Events

L.Control.Level will fire levelchange events when a level is selected.

License

Leaflet Indoor is free software, and may be redistributed under the BSD 2-Clause License.