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

maplibre-pegman

v1.0.3

Published

A MapLibre GL JS plugin that allows easy integration with the Google StreetView Service API via a draggable Pegman control

Readme

maplibre-pegman

A MapLibre GL JS plugin that allows easy integration with the Google StreetView Service API via a draggable Pegman control.


How to use

1. Include dependencies

<!-- MapLibre GL JS -->
<link rel="stylesheet" href="https://unpkg.com/maplibre-gl@3/dist/maplibre-gl.css" />
<script src="https://unpkg.com/maplibre-gl@3/dist/maplibre-gl.js"></script>

<!-- interact.js (required for drag-and-drop) -->
<script src="https://unpkg.com/[email protected]/dist/interact.min.js"></script>

Note: If you omit the interact.js and Google Maps script tags, they will be lazy-loaded automatically on first user interaction.

2. Include the plugin

Via CDN / script tag

<link rel="stylesheet" href="https://unpkg.com/maplibre-pegman/maplibre-pegman.css" />
<script src="https://unpkg.com/maplibre-pegman/maplibre-pegman.js"></script>

Via npm

npm install maplibre-pegman
const MaplibrePegman = require('maplibre-pegman');
// or
import MaplibrePegman from 'maplibre-pegman';

Don't forget to include the CSS file as well (import it via your bundler or add a <link> tag).

3. Add the control to your map

var map = new maplibregl.Map({
  container: 'map',
  style: 'https://demotiles.maplibre.org/style.json',
  center: [9.5, 45],
  zoom: 5
});

var pegmanControl = new MaplibrePegman({
  position: 'top-right',
  theme: 'leaflet-pegman-v3-default',
  apiKey: 'YOUR_GOOGLE_MAPS_API_KEY',
});

pegmanControl.addTo(map);

Options

| Option | Type | Default | Description | | ------------ | -------- | ------------------------------ | ------------------------------------------------------------------------ | | position | String | 'top-right' | Position of the control: 'top-left', 'top-right', 'bottom-left', 'bottom-right' | | theme | String | 'leaflet-pegman-v3-default' | CSS theme class. 'leaflet-pegman-v3-default' (40px) or 'leaflet-pegman-v3-small' (30px) | | debug | Boolean| false | Enable console logging | | apiKey | String | '' | Google Maps API key (required for StreetView) | | libraries | String | '' | Comma-separated list of additional Google Maps libraries (e.g. 'geometry') | | pano | Object | {enableCloseButton: true, ...} | Options passed to google.maps.StreetViewPanorama | | panoDiv | String | null | CSS selector for a detached panorama <div> (e.g. '#panorama'). If omitted, the panorama overlays the map. |


Events

The control fires events with the prefix svpc_:

| Event | Description | | ------------------------------- | -------------------------------- | | svpc_pegman-dragging | Pegman drag started | | svpc_pegman-dragged | Pegman drag ended | | svpc_pegman-added | Pegman marker placed on map | | svpc_pegman-removed | Pegman marker removed from map | | svpc_streetview-shown | StreetView layer activated | | svpc_streetview-hidden | StreetView layer deactivated | | svpc_dropzone-actived | Map drop zone activated | | svpc_dropzone-drag-entered | Pegman dragged into map | | svpc_dropzone-drag-leaved | Pegman dragged out of map | | svpc_dropzone-drop | Pegman dropped on map | | svpc_dropzone-deactivated | Map drop zone deactivated |

pegmanControl.on('svpc_pegman-added', function() {
  console.log('Pegman placed on map!');
});

API Methods

| Method | Description | | ---------------------------------- | ----------------------------------------------- | | addTo(map) | Add the control to a MapLibre map | | pegmanAdd() | Place the pegman marker at stored coordinates | | pegmanRemove() | Remove the pegman marker from the map | | findStreetViewData(lat, lng) | Search for StreetView data at the given location | | toggleStreetViewLayer() | Toggle the StreetView mode on/off | | showStreetViewLayer() | Activate StreetView mode | | hideStreetViewLayer() | Deactivate StreetView mode | | openStreetViewPanorama() | Show the panorama div | | closeStreetViewPanorama() | Hide the panorama div | | clear() | Remove pegman, hide layer, close panorama |


Requirements


Notes

  • Google StreetView coverage tile overlay is not available in the MapLibre version because Google's tile endpoint does not serve CORS headers. The core StreetView panorama functionality (drag pegman, click map, open panorama) works fully.
  • Press Escape to close the panorama and remove the pegman marker.

License

GPL-3.0+