Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-7005

facet.heatmap for spatial heatmap faceting on RPT



    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 5.1
    • spatial
    • None


      This is a new feature that uses the new spatial Heatmap / 2D PrefixTree cell counter in Lucene spatial LUCENE-6191. This is a form of faceting, and as-such I think it should live in the "facet" parameter namespace. Here's what the parameters are:

      • facet=true
      • facet.heatmap=fieldname
      • facet.heatmap.geom=["-180 -90" TO "180 90"]
      • facet.heatmap.gridLevel=6
      • facet.heatmap.distErrPct=0.15
      • facet.heatmap.format=ints2D | png
        (Officially see FacetParams where options are documented)

      Like other faceting features, the fieldName can have local-params to exclude filter queries or specify an output key. This could be quite useful in doing difference faceting on the same spatial data to identify relative change against a baseline.

      The geom is optional; you get the whole world or you can specify a box or WKT.

      Ultimately, this feature needs to know the grid level, which together with the input shape will yield a certain number of cells. You can specify gridLevel exactly, or don't and instead provide distErrPct which is computed like it is for the RPT field type as seen in the schema. 0.10 yielded ~4k cells but it'll vary. There's also a facet.heatmap.maxCells safety net defaulting to 100k. Exceed this and you get an error.

      The output is (JSON):

      {gridLevel=6,columns=64,rows=64,minX=-180.0,maxX=180.0,minY=-90.0,maxY=90.0,counts_ints2D=[[0, 0, 2, 1, ....],[1, 1, 3, 2, ...],...]}

      counts_ints2D is null if all would be 0. individual row arrays should likewise be null... I welcome feedback.

      If you set the output to 'png' then you get a 4-byte per pixel/cell PNG, or null if all counts are 0. The high byte (alpha channel) is inverted so that counts need to exceed 2^24 before the image will start to fade out if you try and view it.

      This supports sharded / distributed queries.


        1. heatmap_512x256.png
          66 kB
          David Smiley
        2. heatmap_64x32.png
          3 kB
          David Smiley
        3. SOLR-7005_heatmap.patch
          45 kB
          David Smiley
        4. SOLR-7005_heatmap.patch
          44 kB
          David Smiley
        5. SOLR-7005_heatmap.patch
          44 kB
          David Smiley
        6. SOLR-7005_heatmap.patch
          27 kB
          David Smiley

        Issue Links



              dsmiley David Smiley
              dsmiley David Smiley
              2 Vote for this issue
              8 Start watching this issue