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 🙏

© 2025 – Pkg Stats / Ryan Hefner

prp-map

v0.0.24

Published

A React component for displaying a map

Downloads

44

Readme

Parks and Recreation Program (PRP) Map

A React library for displaying vector features on interactive maps using OpenLayers.

Installation

npm install @bcgov/prp-map

Usage

Basic VectorFeatureMap

import { VectorFeatureMap } from '@bcgov/prp-map';

const MyMap = () => {
  const layers = [
    {
      id: "my-features",
      features: myFeatures,
      visible: true
    }
  ];

  return (
    <VectorFeatureMap 
      layers={layers}
      defaultZoom={10}
      center={[-123.1207, 49.2827]} // Vancouver coordinates
    />
  );
};

Using Custom Base Layers

You can provide your own base layers instead of using the default ones:

import { VectorFeatureMap, BaseLayerConfig } from '@bcgov/prp-map';
import VectorTileLayer from 'ol/layer/VectorTile';
import VectorTileSource from 'ol/source/VectorTile';
import MVT from 'ol/format/MVT';

const MyMapWithCustomBaseLayers = () => {
  const customBaseLayers: BaseLayerConfig[] = [
    new VectorTileLayer({
      source: new VectorTileSource({
        format: new MVT(),
        url: 'https://your-tile-server/{z}/{x}/{y}.mvt',
        wrapX: true,
      }),
    }),
  ];

  const layers = [
    {
      id: "my-features",
      features: myFeatures,
      visible: true
    }
  ];

  return (
    <VectorFeatureMap 
      layers={layers}
      baseLayers={customBaseLayers}
      defaultZoom={10}
    />
  );
};

API Reference

VectorFeatureMap Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | layers | VectorLayerConfig[] | Required | Array of vector layer configurations | | style | React.CSSProperties | undefined | Optional CSS styles for the map container | | children | ReactNode | undefined | Child components to render within the map context | | enableTracking | boolean | false | Enables/disables Matomo tracking | | defaultZoom | number | 4 | Initial zoom level for the map | | minZoom | number | 1 | Minimum zoom level for the map | | maxZoom | number | 18 | Maximum zoom level for the map | | center | [number, number] | undefined | Initial center coordinate for the map | | extent | [number, number, number, number] | undefined | Extent to fit the map to | | baseLayers | BaseLayerConfig[] | undefined | Custom base layers (falls back to defaults if not provided) |

VectorLayerConfig

| Property | Type | Description | |----------|------|-------------| | id | string | Unique identifier for the layer | | features | Feature[] | OpenLayers features to display | | layerInstance | Layer | Pre-constructed OpenLayers layer | | visible | boolean | Whether the layer is visible | | onLayerAdded | (extent: Coordinate) => void | Callback when layer is added to map |

BaseLayerConfig

A type alias for OpenLayers Layer - any OpenLayers layer can be used as a base layer.

Development

  1. Run npm install to install dependencies
  2. Run npm run dev to start the development server
  3. Open your browser and navigate to http://localhost:3000 to view the example application

Creating new components

  • Create a new folder in the src/components directory
  • Add a new file for your component, e.g., MyComponent.tsx
  • Export the component as a default export
  • Add the export to the src/index.ts file to make it available as part of the library
  • Add it to the example application by importing and using it in src/App.tsx
  • Run npm run dev to see your changes in the example application

Publishing

  1. Ensure you are a maintainer in the @bcgov NPM organization
  2. Update the version in package.json
  3. Run npm login to log in to your NPM account
  4. Run npm run publish which will:
    • Build the library
    • Publish it to NPM