# GeoHash plotting in Vega

**URL:** <https://discuss.elastic.co/t/geohash-plotting-in-vega/174194>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [March 27, 2019, 8:02pm UTC](https://discuss.elastic.co/t/geohash-plotting-in-vega/174194 "2019-03-27T20:02:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sushmamagesh](https://avatars.discourse-cdn.com/v4/letter/s/8491ac/32.png) [@sushmamagesh](https://discuss.elastic.co/u/sushmamagesh)\
**Post date:** [March 27, 2019, 8:02pm UTC](https://discuss.elastic.co/t/geohash-plotting-in-vega/174194/1 "2019-03-27T20:02:30Z")

</div>

Hi

whats the best way to plot geo hash values in Vega?

My query:

```
GET index*/_search?size=0
{
  "aggs" : {
    "large-grid" : {
      "geohash_grid" : {
        "field" : "geoip.location",
          "precision" : 3
      }
    }
  }
}

```

Results:  
"aggregations" : {  
"large-grid" : {  
"buckets" : [  
{  
"key" : "9yd",  
"doc\_count" : 6628672  
},  
{  
"key" : "9qh",  
"doc\_count" : 1546684  
},  
{  
"key" : "9tb",  
"doc\_count" : 1502557  
},  
{  
"key" : "dp3",  
"doc\_count" : 1499205  
},

---

<div class="post-metadata">

**Author:** ![nyuriks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nyuriks/32/26171_2.png) [@nyuriks](https://discuss.elastic.co/u/nyuriks)\
**Post date:** [March 27, 2019, 11:02pm UTC](https://discuss.elastic.co/t/geohash-plotting-in-vega/174194/2 "2019-03-27T23:02:33Z")

</div>

@sushmamagesh I have semi-good and a bad news 🙂 converting geohashes into a lat,lng (or getting a bounding box describing that code is a [fairly complex](https://en.wikipedia.org/wiki/Geohash#Algorithm_and_example) thing mathematically. In theory it is possible, but would require some head scratching to get Vega to decode those values. On the other hand, Elasticsearch 7.0 introduces a new [geotile\_grid aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-geotilegrid-aggregation.html) whose key values will be far easier to decode -- they are tile-like, e.g. 5/2/12 (zoom/x/y), so a simple expression would convert it to lat/lng (see [stackexchange question](https://gis.stackexchange.com/questions/133205/wmts-convert-geolocation-lat-long-to-tile-index-at-a-given-zoom-level) or [osm wiki](https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Lon..2Flat._to_tile_numbers_2)). Lastly, we recently had a related [ES discussion](https://github.com/elastic/elasticsearch/issues/39810) to support these kinds of cases - so that you can add an expression directly into ES query that would decode those hashes for you, but this is currently at a planning stage.

---

<div class="post-metadata">

**Author:** ![sushmamagesh](https://avatars.discourse-cdn.com/v4/letter/s/8491ac/32.png) [@sushmamagesh](https://discuss.elastic.co/u/sushmamagesh)\
**Post date:** [March 28, 2019, 6:34pm UTC](https://discuss.elastic.co/t/geohash-plotting-in-vega/174194/3 "2019-03-28T18:34:44Z")

</div>

Perfect. Thanks Yuri. Will try that.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 25, 2019, 6:34pm UTC](https://discuss.elastic.co/t/geohash-plotting-in-vega/174194/4 "2019-04-25T18:34:55Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
