11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Heatmap Faceting<br />

The RPT field supports generating a 2D grid of facet counts for documents having spatial data in each grid cell.<br />

For high-detail grids, this can be used to plot points, and for lesser detail it can be used for heatmap generation.<br />

The grid cells are determined at index-time based on RPT's configuration. At facet counting time, the indexed<br />

cells in the region of interest are traversed and a grid of counters corresponding to each cell are incremented.<br />

<strong>Solr</strong> can return the data in a straight-forward 2D array of integers or in a PNG which compresses better for<br />

larger data sets but must be decoded.<br />

The heatmap feature is accessed from <strong>Solr</strong>'s faceting feature. As a part of faceting, it supports the key local-par<br />

am as well as excluding tagged filter queries, just like other types of faceting do. This allows multiple heatmaps<br />

to be returned on the same field with different filters.<br />

Parameter<br />

Description<br />

facet Set to true to enable faceting<br />

facet.heatmap<br />

facet.heatmap.geom<br />

facet.heatmap.gridLevel<br />

facet.heatmap.distErrPct<br />

facet.heatmap.distErr<br />

The field name of type RPT<br />

The region to compute the heatmap on, specified using the rectangle-range syntax<br />

or WKT. It defaults to the world. ex: ["-180 -90" TO "180 90"]<br />

A specific grid level, which determines how big each grid cell is. Defaults to being<br />

computed via distErrPct (or distErr)<br />

A fraction of the size of geom used to compute gridLevel. Defaults to 0.15. It's<br />

computed the same as a similarly named parameter for RPT.<br />

A cell error distance used to pick the grid level indirectly. It's computed the same as<br />

a similarly named parameter for RPT.<br />

facet.heatmap.format The format, either ints2D (default) or png.<br />

Tip<br />

You'll experiment with different distErrPct values (probably 0.10 - 0.20) with various input geometries till<br />

the default size is what you're looking for. The specific details of how it's computed isn't important. For<br />

high-detail grids used in point-plotting (loosely one cell per pixel), set distErr to be the number of<br />

decimal-degrees of several pixels or so of the map being displayed. Also, you probably don't want to use<br />

a geohash based grid because the cell orientation between grid levels flip-flops between being square<br />

and rectangle. Quad is consistent and has more levels, albeit at the expense of a larger index.<br />

Here's some sample output in JSON (with some ..... inserted for brevity):<br />

{gridLevel=6,columns=64,rows=64,minX=-180.0,maxX=180.0,minY=-90.0,maxY=90.0,<br />

counts_ints2D=[[0, 0, 2, 1, ....],[1, 1, 3, 2, ...],...]}<br />

The output shows the gridLevel which is interesting since it's often computed from other parameters. If an<br />

<strong>Apache</strong> <strong>Solr</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>6.0</strong><br />

376

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!