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

leaflet-solr-heatmap

v0.3.0

Published

A Leaflet plugin that visualizes heatmap facets from Solr 5.x

Downloads

4

Readme

Leaflet-Solr-Heatmap

A Leaflet plugin that visualizes heatmap facets from Solr 5.x

Using with Leaflet

// Create a SolrHeatmap layer and add it to the map
var solr = L.solrHeatmap('http://127.0.0.1:8983/solr/gettingstarted', {
  // Solr field with geospatial data (should be type Spatial Recursive Prefix Tree)
  field: 'loc_srpt',

  // Set type of visualization. Allowed types: 'geojsonGrid', 'clusters'
  // Note: 'clusters' requires LeafletMarkerClusterer
  type: 'geojsonGrid'
}).addTo(map);

Option | Type | Default | Description ------ | ---- | ------- | ----------- field | String | null | Required. Solr field with geospatial data (should be type Spatial Recursive Prefix Tree) type | String | 'geojsonGrid' | Type of visualization. Accepts geojsonGrid, clusters and heatmap solrRequestHandler | String | 'select' | Request handler for Solr colors | Array | ['#f1eef6', '#d7b5d8', '#df65b0', '#dd1c77', '#980043'] | Colors for heatmap. Array can be of any length. maxSampleSize | Number | Number.MAX_SAFE_INTEGER | For improved performance, run Jenks classification on only a sample of Solr counts. Default value turns off sampling. Typical value is 400. queryAdapter | String | default | A query adapter used to connect to a Solr interface. Useful for querying applications that may proxy through Solr. queryRadius | Number | 40 | Radius (in pixels) used for querying nearby data

Events

L.SolrHeatmap layers fire all of the typical events from Leaflet. Additional events include:

Event | Data | Description ----- | ---- | ----------- dataAdded | Object | fires when data is added to the map. Returns an object which is the JSON response from the Solr server

Running locally

Install Dependencies

# Install JavaScript depencencies
$ npm install

# Install local solr
$ gem install solr_wrapper

Run Solr

$ solr_wrapper

Index fixture data

$ npm run index

Start local server

npm run start

View the example at http://127.0.0.1:8000/example/

Adapting to different API interfaces

Leaflet Solr Heatmap uses an abstracted query adapater, that can be used to query API's besides the default Solr API. This has been used in Blacklight Heatmaps. Adapters can be added to the L.SolrHeatmapQueryAdapters object and then selected using the L.solrHeatmap options instantiation. Query adapters need to implment the following methods:

Method | Returns | Purpose ajaxOptions | Object | Merged options object that defines $.ajax url and settings. responseFormatter | Object | A way to access a custom API resposne formatter. Should return an Object that behaves as the Solr Facet Heatmap JSON response (or just passes it through).