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

openlayers-indoorequal

v0.1.3

Published

Integrate indoor= into your OpenLayers map.

Downloads

40

Readme

openlayers-indoorequal build npm

openlayers-indoorequal is an OpenLayers library to display indoor data from indoor=.

It provides:

  • a default style of the indoor tiles
  • a way to customize the style
  • 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:

OpenLayers compatibility

  • OL < 8: use version 0.0.8
  • OL 8 & 9: use version >= 0.1.0

Install

With NPM

npm install --save openlayers-indoorequal

In the browser

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

Example

Get your free key at indoorequal.com.

import Map from 'ol/Map';
import TileLayer from 'ol/layer/Tile';
import OSM from 'ol/source/OSM';
import IndoorEqual, { LevelControl } from 'openlayers-indoorequal';
import 'openlayers-indoorequal/openlayers-indoorequal.css';

const apiKey = '<your-indoorequal-api-key>';

const map = new Map({
  target: 'map',
  layers: [
    new TileLayer({
      source: new OSM(),
    }),
  ],
});

const indoorEqual = new IndoorEqual(map, { apiKey });

const control = new LevelControl(indoorEqual);
map.addControl(control);

Loading the default sprite

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

To load the sprite, set the spriteBaseUrl property option on the constructor 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/openlayers-indoorequal/sprite"
},

Then load the sprite:

const indoorequal = new IndoorEqual(map, { apiKey: 'myKey', spriteBaseUrl: '/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/openlayers-indoorequal/sprite' },
      ],
    }),
  ],
};

Then load the sprite:

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

API

Table of Contents

LevelControl

Extends Control

A control to display the available levels

Parameters

  • indoorEqual IndoorEqual the IndoorEqual instance

  • options object (optional, default {})

    • options.target string? Specify a target if you want the control to be rendered outside of the map's viewport.

Returns LevelControl this

IndoorEqual

Extends BaseObject

Load the indoor= source and layers in your map.

Parameters

  • map object the OpenLayers instance of the map

  • options object (optional, default {})

    • options.defaultStyle boolean? False to not set the default style. Default true.
    • options.spriteBaseUrl string? The base url of the sprite (without .json or .png). If not set, no sprite will be used in the default style.
    • options.url string? Override the default tiles URL (https://tiles.indoorequal.org/).
    • options.apiKey string? The API key if you use the default tile URL (get your free key at indoorequal.com).
    • options.heatmap boolean? Should the heatmap layer be visible at start (true : visible, false : hidden). Defaults to true/visible.

Returns IndoorEqual this

setStyle

Set the style for displayed features. This function takes a feature and resolution and returns an array of styles. If set to null, the layer has no style (a null style), so only features that have their own styles will be rendered in the layer. Call setStyle() without arguments to reset to the default style. See module:ol/style for information on the default style.

Parameters
  • styleFunction function the style function

setHeatmapVisible

Change the heatmap layer visibility

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

IndoorEqual#change:levels

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

Run tests

yarn test [--watch]

Build a new version

yarn build

Generate the documentation

yarn doc

License

BSD