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

@mapvx/web-js

v1.0.1

Published

MapVX maps web SDK

Readme

MapVX Web SDK

A framework-agnostic TypeScript SDK for integrating indoor navigation and mapping capabilities into web applications. Works with Angular, React, Lit, and vanilla JavaScript.

Installation

The package is available on the public npm registry. No authentication token is required.

npm install @mapvx/web-js

Then load the SDK styles using one of these methods:

import { initializeSDK, loadStyles } from "@mapvx/web-js"

// Load default styles (includes all required CSS)
loadStyles()

Or include the stylesheet manually in your HTML:

<link rel="stylesheet" href="./node_modules/@mapvx/web-js/dist/umd/styles.css" />

Module Formats

The SDK ships in three formats:

| Format | Entry Point | Use Case | | ------ | ----------- | -------- | | ESM | dist/es/index.js | Modern bundlers (Vite, webpack 5, Rollup) | | CJS | dist/cjs/index.js | Node.js, legacy bundlers | | UMD | dist/umd/index.js | <script> tags, CDNs |

Bundlers automatically pick the right format via the exports field in package.json.

Quick Start

import { initializeSDK } from "@mapvx/web-js"

// Initialize the SDK with your API token
const sdk = initializeSDK("your-api-token")

// Create a map
const container = document.getElementById("map-container")
const map = sdk.createMap(container, {
  zoom: 18,
  center: { lat: 40.7128, lng: -74.006 },
  parentPlaceId: "your-building-id",
  onMapReady: () => console.log("Map is ready!"),
})

Core Features

Fetching Places

// Get all available places for your API token
const places = await sdk.getAvailablePlaces()

// Get sub-places within a building
const subPlaces = await sdk.getSubPlaces("building-id")

// Get details for a specific place
const place = await sdk.getPlaceDetail("place-id")

// Search for places
const results = await sdk.getPlacesByInput("coffee", "institution-id", "building-id")

Navigation Routes

// Get a route between two points
const route = await sdk.getRoute({
  parentPlaceId: "building-id",
  from: { placeId: "origin-place-id" },
  to: { placeId: "destination-place-id" },
  mode: "walking",
})

// Draw a route on the map
const routeOnMap = await map.addRoute(
  {
    parentPlaceId: "building-id",
    from: { placeId: "origin-place-id" },
    to: { placeId: "destination-place-id" },
  },
  {
    width: 4,
    style: { type: "solid", color: "#007AFF" },
  }
)

// Animate a route
await map.startAnimateRoute({
  parentPlaceId: "building-id",
  from: { placeId: "origin-place-id" },
  to: { placeId: "destination-place-id" },
})

Markers

// Add a marker
const markerId = map.addMarker({
  id: "my-marker",
  position: { lat: 40.7128, lng: -74.006 },
  color: "#FF0000",
})

// Update marker position
map.updateMarkerPosition("my-marker", { lat: 40.713, lng: -74.007 })

// Remove a marker
map.removeMarker("my-marker")

User Location

// Track user location on the map
map.addUserLocationTracking(true) // true for high accuracy

// Watch user position
const watchId = sdk.watchUserPosition(
  (position) => console.log("Position:", position),
  (error) => console.error("Error:", error)
)

// Stop watching
sdk.unWatchUserPosition(watchId)

Floor Navigation

// Change the displayed floor
map.updateFloor("floor-2")

// Get current floor
const currentFloor = map.getCurrentFloor()

// Listen for floor changes
const mapConfig = {
  // ...other config
  onFloorChange: (newFloorId) => console.log("Floor changed to:", newFloorId),
}

Configuration Options

SDK Configuration

const sdk = initializeSDK("your-api-token", {
  lang: "en", // Language for labels and responses
  apiUrl: "https://public-api.mapvx.com", // API endpoint (default)
  cache: {
    persistent: true, // Enable localStorage persistence
    maxStorageBytes: 5 * 1024 * 1024, // 5MB cache limit
    configs: {
      places: { maxItems: 1000, ttlMs: 60000 },
    },
  },
})

Map Configuration

const map = sdk.createMap(container, {
  zoom: 18,
  center: { lat: 40.7128, lng: -74.006 },
  parentPlaceId: "building-id",

  // Optional settings
  minZoom: 15,
  maxZoom: 22,
  pitch: 45, // 3D tilt in degrees
  showCompass: true,
  showZoom: true,
  navigationPosition: "top-right",
  enableHover: true,
  lang: "en",

  // Tile caching for performance
  tileCache: {
    enabled: true,
    maxTiles: 500,
    ttlMs: 60 * 60 * 1000, // 1 hour
    persistToServiceWorker: true,
    preloadAdjacentZooms: false,
  },

  // Event callbacks
  onMapReady: () => {},
  onZoomEnd: (zoomLevel) => {},
  onRotate: (degrees) => {},
  onFloorChange: (floorId) => {},
  onParentPlaceChange: (placeId) => {},
})

Tile Cache Management

The SDK provides built-in tile caching for improved performance:

// Configure tile caching when creating the map
const map = sdk.createMap(container, {
  // ...other config
  tileCache: {
    enabled: true, // Enable caching (default: true)
    maxTiles: 400, // Max tiles in memory (default: 400)
    ttlMs: 30 * 60 * 1000, // Cache TTL in ms (default: 30 minutes)
    persistToServiceWorker: true, // Enable offline caching (default: true)
    preloadAdjacentZooms: false, // Preload nearby zoom levels (default: false)
  },
})

// Clear the tile cache when needed
map.clearTileCache()

Documentation

For complete documentation and examples, visit the MapVX Web SDK Docs.

API Reference

FAQ

Q: Navigation controls are missing on map generation, what can I do?

A: Ensure you have included the MapLibre GL CSS and JS files in your HTML. See the Installation section above.

Q: How do I handle multiple buildings?

A: Use the otherPotentialParentPlacesIds option in your map configuration or the otherParentPlacesIds parameter when searching for places.

Q: How do I enable offline map access?

A: Set persistToServiceWorker: true in the tileCache configuration. This enables service worker caching for offline tile access.

Support

For support, please contact your MapVX representative or visit MapVX.