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

pure-leaflet

v2.0.2

Published

A React map component that allows geoJSON shapes to be drawn, edited, and loaded into leaflet layers

Downloads

5

Readme

PureLeafletMap

A React map component that allows geoJSON shapes to be drawn, edited, and loaded into leaflet layers

Built with leaflet.js and leaflet.pm

Leaflet Geosearch uses the Google Provider

Check index.d.ts to see the props.

Getting Started:

npm install pure-leaflet

Usage

import Map from 'pure-leaflet'

Props:

tileProvider:

Type: string

optional: true

Default: OpenStreetMap.Mapnik

Description: List of providers are Here Folling keys are MAP_CREATOR.variant ex: Esri.WorldStreetMap

editable

Type: boolean

Default: true

Description: Toggle edit/draw control


cutMode

Type: boolean

Default: false

Requires: editable: true

Description: Toggles ability to cut polygons/shapes


onShapeChange

Type: (Array<geoJSON>) => {}

Default: noop

Description: Fired when a shape is drawn/edited on map


features:

Type: Array<geoJSON>

Default: null

Description: Array of geoJSON features to be drawn on the map


searchProvider:

Type: string

Default: google

Supported Providers:

  • ESRI: esri
  • GoogleMaps*: google
  • Open Street maps: openstreet
  • LocationIQ*: loqIQ
  • Bing*: bing
  • Open Cage: opencage
  • providers need an API key for access

apiKey:

Type: string

Default: ''

Description: API key for Google maps


center:

Type: [lat, lng]

Default: [38.194706, -85.71053]

Description: The starting center position for the map


markerHtml:

Type: string

Default: <svg width="8" height="8" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="4" cy="4" r="4" stroke="red" fill="red" stroke-width="0" /></svg>

Description: Icon for marker when searching


mapCount:

Type: number

Default: ''

Description: Interger to render more than 1 map on the same page. (i.e.... mapCount={1} makes Map Div ID:mapid1)


getBounding:

Type: Function

Default:false

Optional: true

Description: Function that returns the bounding box of the current visible map. Fired on zoomEnd

Example: (data) => data where data is:

{ "_southWest": { "lat": 37.54239958054067, "lng": -99.90966796875001 }, "_northEast": { "lat": 39.404366615861036, "lng": -96.40777587890625 } zoom: 13 }


hideSearch:

Type: boolean

Optional: true

Default: false

Description: A flag to disable/hide the search button included on the map.


geoLocate:

Type: type ResultType = { x: string // lon, y: string // lat, label: string // formatted address bounds: string[][] raw: RawType // raw provider result };

Optional: true

Description: Allows outside results from geolocation to be passed to the map. For more informations about types look in index.d.ts

NOTE: Currently only works with `openstreet` as the `provider`.


tooltipContent:

Type: { comp?: string; func?: () => void tooltip?: string; values?: Array<string> }

Optional: true

Description: comp: is the popup content when a marker is clicked func: function to pass into popup tooltip: tooltip content. values: If template string is used, This is the array of fields to check in the features properties field.

Example: This works for popup/tooltip

comp: `<div>this is a {var}</div>`
values: ['var']
and the GeoJSON: 

{
    type: 'Feature',
    properties: {
      var: 'test'
      key: 'cbb7672e-1e85-4c0b-8bcb-5bfc5af2d736',
    },
    geometry: {
      type: 'Point',
      coordinates: [-85.76399, 38.257058],
    },
  },```

  compiles to 

  ```<div>this is a test</div>```