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

nkm-mapbox-map

v0.1.6

Published

Map component using mapbox gl js library.

Downloads

2

Readme

nkm Mapbox Map

Map component using mapbox gl js library.

Parameters

| option | Required | Type | Default | Description | |-------------|----------|--------|---------|------------------------ | | accessToken | required | string | none | mapbox accessToken (talk to Keino) | | styleUrl | required | string | none | mapbox style url (talk to Keino for norkarts own style) | | centerCoords| x | obj | {lat: 65.2, lng: 15.4 } | center coordinates for the map | | zoomLevel | x | number | 3.6 | zoom level for map | | shouldFly | x | boolean | true | If map should have a smooth fly to effect when center coords are changed | | pitch | x | number | 0 | Pitch (tilt) for map in degrees | | bearing | x | number | 0 | Bearing (rotation) for map in degrees | | fireMapResize | x | boolean | false | Fires a resize of the map that is necessary after changing size of container. Useful for implementing for example full screen.| |layers | x | array of objects | none | List of valid mapbox geojson layers. See example below | |interactive| x | boolean | true | If map should be interactive or static | |controls | x | array of objects with fields control and options | none | a list of controls that should be added to the map, for example: [{'control': this.draw, 'option': 'top-left'}]| |events | x | array of objects with fields type and callback | none | a list of events that should be added to the map, for example: [{'type': 'draw.create', 'callback': this._handleDrawUpdate}];| |onMapLoaded | x | function | none | callback that is called once map is completed loading | |onMoveend | x | function | none | callback for when moveend event is fired, that returns a mapview object containing the new: center, zoom, pitch, bearing and bbox | |onLayerDragged | x | function | none | callback for when map is unmounting that sends latlng on draggable layer so that you know the final position of the draggable point. | |wmsLayers | x | array | none | wms layers to draw, with extra options as explained in example | |fitBounds | x | object| none | option for fitting mapview to a bbox. Exp: fitBounds: {bounds:[11.1422228114504, 60.2830018178217, 11.1676969648912, 60.2979382905685], padding: 20 }. Padding is optional, and default 0. NB! This will ignore other props concering mapview (i.e. centerCoords).|

Valid mapbox geojson layer

'id': 'maine',
'type': 'fill',
'source': {
    'type': 'geojson',
    'data': {
        'type': 'Feature',
        'geometry': {
            'type': 'Polygon',
            'coordinates':
                [[[-67.13734351262877, 45.137451890638886],
                [-66.96466, 44.8097],
                [-68.03252, 44.3252]]]
        }
    }
},
'layout': {},
'paint': {
    'fill-color': '#088',
    'fill-opacity': 0.8
}

Draggable layer

If you want one of your layers to be draggable add draggable: true to properties in the geojson layer. NB! Only works on point layers

'id': 'maine',
'type': 'fill',
'source': {
    'type': 'geojson',
    'data': {
       ...
    }
},
'layout': {},
'properties' {
    draggable: true
}

If you want another layer to follow the draggable layer (i.e a polygon following a draggable point) add followDraggable: true to properties in the geojson layer

'id': 'maine',
'type': 'fill',
'source': {
    'type': 'geojson',
    'data': {
        ...
    }
},
'layout': {},
'properties' {
   followDraggable: true
}

wmsLayer

These are example options, but you can read more on mapbox docs.

| option | Required | Type | Default | Description | |-------------|----------|--------|---------|------------------------ | |id | x |string | none | unique identifier| |url | x |string | none | url for wms. Exp: https://openwms.statkart.no/skwms1/wms.vegnett?LAYERS=all&TRANSPARENT=TRUE&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG:3857&BBOX={bbox-epsg-3857}&WIDTH=256&HEIGHT=256| |minZoom | x |number | none | minimale zoom for displaying the layer| |maxZoom | x |number | none | maximum zoom for displaying the layer (NB! Hidden on giben maxZoom)| minZoom: PropTypes.number, maxZoom: PropTypes.number, url: PropTypes.string

Developing:


- run ```npm start```
- edit code in ```src/```

Deploying:


  1. Update version number in package.json
  2. npm publish

Testing


npm test