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 🙏

© 2024 – Pkg Stats / Ryan Hefner

mapbox-gl-indoorequal

v0.2.16

Published

Integrate indoor= into your mapbox-gl.js map.

Downloads

19

Readme

mapbox-gl-indoorequal build npm

mapbox-gl-indoorequal is a maplibre-gl or mapbox-gl.js plugin to display indoor data from indoor=.

It provides:

  • load vector tiles from indoorequal.org tile server or your own
  • display GeoJSON data
  • a default style of the indoor tiles
  • a way to customize the style and load your sprites
  • a level control to change the level displayed on the map
  • a programatic API to list the levels available and set the level displayed

See the demo.

Discover:

Install

Recommended versions:

  • mapbox-gl to use is the 1.12 (released in august 2020) or higher
  • maplibre-gl 1.15.2

With NPM

npm install --save mapbox-gl-indoorequal

In the browser

<script src="https://unpkg.com/mapbox-gl-indoorequal@latest/dist/mapbox-gl-indoorequal.umd.min.js"></script>
<link href="https://unpkg.com/mapbox-gl-indoorequal@latest/mapbox-gl-indoorequal.css" rel="stylesheet" />

Example

Get your free key at indoorequal.com.

import mapboxgl from 'mapbox-gl';
import IndoorEqual from 'mapbox-gl-indoorequal';
import 'mapbox-gl-indoorequal/mapbox-gl-indoorequal.css';

mapboxgl.accessToken = '<your-token>';

const map = new mapboxgl.Map({
  container: 'map',
  style: 'mapbox://styles/mapbox/light-v10',
  center: [2.3601072, 48.876853],
  zoom: 18
});

const indoorEqual = new IndoorEqual(map, { apiKey: 'mykey' });
map.addControl(indoorEqual);

Loading the default sprite

The default style make uses of a sprite that has to be loaded manually as mapbox-gl require an absolute path. The sprite is already builded and available in the sprite directory.

To load the sprite, use the loadSprite method with the absolute path to the sprite and its name /directory-to-change/indoorequal.

Usage with Parcel

Install the parcel-plugin-static-files-copy package and add to your package.json:

"staticFiles": {
  "staticPath": "node_modules/mapbox-gl-indoorequal/sprite"
},

Then load the sprite:

const indoorequal = new IndoorEqual(map, { apiKey: 'myKey' });
indoorequal.loadSprite('/indoorequal');

Usage with webpack

Install the copy-webpack-plugin package and add to your webpack config:

const CopyPlugin = require('copy-webpack-plugin');

module.exports = {
  plugins: [
    new CopyPlugin({
      patterns: [
        { from: 'node_modules/mapbox-gl-indoorequal/sprite' },
      ],
    }),
  ],
};

Then load the sprite:

const indoorequal = new IndoorEqual(map, { apiKey: 'myKey' });
indoorequal.loadSprite('/indoorequal');

API

Table of Contents

IndoorEqual

Load the indoor= source and layers in your map.

Parameters

  • map object the mapbox-gl/maplibre-gl instance of the map

  • options object (optional, default {})

    • options.url string? Override the default tiles URL (https://tiles.indoorequal.org/).
    • options.geojson object? GeoJSON data with with key as layer name and value with geojson features
    • options.apiKey string? The API key if you use the default tile URL (get your free key at indoorequal.com).
    • options.layers array? The layers to be used to style indoor= tiles. Take a look a the layers.js file file and the vector schema
    • options.heatmap boolean? Should the heatmap layer be visible at start (true : visible, false : hidden). Defaults to true/visible.

Properties

  • level string The current level displayed
  • levels array The levels that can be displayed in the current view

Returns IndoorEqual this

remove

Remove any layers, source and listeners and controls

on

Add an event listener

Parameters
  • name string the name of the event
  • fn function the function to be called when the event is emitted

off

Remove an event listener.

Parameters
  • name string the name of the event
  • fn function the same function when on() was called

onAdd

Add the level control to the map Used when adding the control via the map instance: map.addControl(indoorEqual)

onRemove

Remove the level control Used when removing the control via the map instance: map.removeControl(indoorEqual)

setLevel

Set the displayed level.

Parameters
  • level string the level to be displayed

updateLevel

Set the displayed level.

Parameters
  • level string the level to be displayed

Meta

  • deprecated: Use setLevel instead

loadSprite

Load a sprite and add all images to the map

Parameters
  • baseUrl string the baseUrl where to load the sprite

  • options object (optional, default {})

    • options.update boolean? Update existing image (default false)

Returns Promise It resolves an hash of images.

setHeatmapVisible

Change the heatmap layer visibility

Parameters
  • visible boolean True to make it visible, false to hide it

IndoorEqual#levelschange

Emitted when the list of available levels has been updated

Type: array

IndoorEqual#levelchange

Emitted when the current level has been updated

Type: string

Develop

Build the plugin and watch for changes

yarn dev

Run tests

yarn test [--watch]

Build a new version

yarn build

Generate the documentation

yarn doc

Generate the sprite

yarn sprite

License

BSD