Skip to content

gornik/gorgeo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gorgeo

Provides a facet for grouping documents containing geolocation data based on the geohash cells. It groups the geographical points by using geohash cells, according to the level provided by user.

Installation

TODO

Example usage

Query example:

  "geohashcell": {
    "field": "location",
    "level" : 3,
    "top_left": "11.21,51.33",
    "bottom_right": "-20.21,80.65"
}

Result example:

   "facets": {
      "f": {
         "_type": "Z2VvaGFzaGNlbGw=",
         "field": "location",
         "top_left": "[11.21, 51.33]",
         "bottom_right": "[-20.21, 80.65]",
         "level": 4,
         "base_map_level": 1,
         "counts": {
            "[8.876953125, 76.46484375]": "1",
            "[6.240234375, 79.98046875]": "1",
            "[6.943359375, 79.98046875]": "13",
            "[9.755859375, 77.87109375]": "2",
            "[2.197265625, 72.94921875]": "1",
            "[9.931640625, 77.51953125]": "3",
            ...
         }
   }

Parameters

Parameter name Optional Default value Description
field optional "location" Name of the document field containing geographical location.
top_left optional "90,-180" Geographical coordinates (lattitude, longitude) of the top left point of the current map viewport.
bottom_right optional "-90,180" Geographical coordinates (lattitude, longitude) of the bottom right point of the current map viewport.
level optional 3 The grouping level (see Algorithm).

Note: the map viewport defaults to a full map.

Results

  • field - equal to the field parameter
  • top_left - equal to the top_left parameter
  • bottom_right - equal to the bottom_right parameter
  • level - actual grouping level (see Algorithm)
  • base_map_level - base grouping level for the current map viewport
  • counts - grouping results, contain cell center and corresponding document count

Algorithm

The facet counts the documents based on geohash prefixes. For more information on how geohashing works, see the following links:

The algorithm groups documents based on geohash prefixes of the stored geographical data. The level parameter provided to the facet is used as a lenght of the geohash prefix for grouping, i.e. increasing the level by one, divides the map into 32 cells.

Additionally the facet adapts to the current map viewport by comparing the current viewport size with sizes of the geohash cells and calculates the base_map_level. This level is than added to the level parameter and used as a geohash prefix. The result is always in [1,6] range.

To do

  • better parameter checking
  • more tests

Credits

Thanks to Mahesh Paolini-Subramanya for his help.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published