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

react-map-layers

v1.1.1

Published

OSU Ecampus' react map layer component

Readme

React Map Layers

This is a react component designed to display shapes on a google map for geoplotting of data.

Setup

Creating a layered map is easy and can be done entirely through JSON. Inside the src/assets/json folder of the parent project create a file called layers.json. This file struture is the following:

[
  {
    "name": "name of layer 1",
    "geojson": "reference_to_geojson1.json",
    "color": "hex color code",
    "data": {
      "id": 0,
      "somekey": "information to be passed to onClick callback"
    }
  },
  {
    "name": "name of layer 2",
    "geojson": "reference_to_geojson2.zip",
    "color": "hex color code",
    "data": {
      "id": 1.
      "somekey": "information to be passed to onClick callback"
    }
  }
]

These objects represent the different layers that will be toggleable by the application. The geojson key is a reference to a json or zip file (in src/assets/geojson) which represents the shape in geojson format. A shapefile can be converted to a geojson file by using this website.

The conversion can also be done by command line with ogr2ogr. The command is:

ogr2ogr -f GeoJSON output.geojson input.shp

Usage

This example simply renders all layers in layers.json on a map.

import layers from './assets/json/layers.json';
...
<ReactMapLayers
  //required props
  googlekey={'somegoogleapikey'}
  layers={layers}
  //optional props
  folder={'./otherfolder/geojson'} //defaults to 'src/assets/geojson'
  style={style} //defaults to {width: '80%', height: '800px', margin: 'auto'}
/>

This example shows how you can toggle different layers from the parent component.

import layers from './assets/json/layers.json';
...
toggleLayer = layerName => {
  if (this.state.layers.some(layer => layer.name === layerName)) {
    this.setState({
      layers: this.state.layers.filter(layer => layer.name !== layerName)
    })
  } else {
    this.setState({
      layers: [...this.state.layers, layers.find(layer => layer.name === layerName)]
    })
  }
}
...
<div>
  <div className="toggle_menu_column">
    {layers.map(layer => <button key={layer.name} onClick={() => this.toggleLayer(layer.name)}> {layer.name} </button>)}
  </div>
  <div className="map_column">
    <ReactMapLayers layers={this.state.layers} googlekey={'somegoogleapikey'}/>
  </div>
</div>

Yarn Scripts

Below are the included yarn scripts for use in development:

start - Just your normal start script, which loads up Webpack and opens your project in a new window.

hot - Same as start, except hot-reloading is enabled which allows CSS to change without restarting the interactive.

silent - Same as hot, except it does not load a new window.

commit - Launches Commitizen, which you'll want to use for your commits.

build - Builds your React application into the ./docs folder.