How Kibana Tile Maps works for Tile Map?


We want to know about how kibana tile Map works for a lots of geopoints. It drwaing points on the basis of zoom level . Looks like doing clustering of the points. May i know the concept behind this?

Sandeep Kumar

Sure thing. When you create a tile map visualization in Kibana, it uses the GeoHash grid aggregation in Elasticsearch to aggregate that data and produce results, which we then plot on the tile map.

Geohash is simply a way to organize and chop up spacial data. If you're looking at a map of the world, imaging chopping it up into a number of blocks that scale with the shape of the earth, so that the blocks are short and wide at the top and bottom, and closer to squares near the equator.

Geohash works by providing a number of characters for the block, which is used to control the precision, or size, of the blocks. From the docs there, "High precision geohashes have a long string length and represent cells that cover only a small area. Low precision geohashes have a short string length and represent cells that each cover a large area." So the higher the precision, the more characters are used to specify the block, and the smaller the block is. This chart in the same docs shows the size of the blocks based on the precision.

Kibana, by default, uses a value that we thing is right for most use cases based on zoom level. I'm believe the values we use in Kibana were created by "feel" - that is, manually setting the zoom level and making a decision about what precision value made the most sense at that zoom level.

Of course, our settings aren't always right, particularly as you get further away from the equator. If that's the case for you, or you simply want to lock the precision regardless of the zoom level, Kibana also offers a slider for users to controls the precision manually.

The reason we use zoom level to control the precision is simply for comprehension. If you have 1000 little dots over a single city, while you're looking at an entire country, it's hard to make sense of the values there - it's easier if the city, or maybe even the whole state, is a single dot instead. However, as you zoom in, you want that large number of dots, like if you're looking at a single state, you don't just want a single point, you likely want to see a number of points across the entire area.

Let me know any of that isn't clear, or if you've got other questions.

1 Like

Thanks Joe.

It's clear that how it makes the group.
But how it calculate the center of the circle means Lat and Long from which it
draw the circle.. I am searching for this from 3 days but unable to find exact
logic of calculating center of the points.

For Example I have 1409 record and 1408 records are the location
of south Africa and 1 location is for India when first time It makes the
group 1408 are in one group with center in somewhere in south Africa But for
another group which have only one record from India have center in Pakistan
when I zoom then It comes near the exact location. I want to know how it
calculate the group center before that I think that they calculate the centroid
of the points but they are doing something else. Can you please give me some
suggestion for this …..

It uses the center of the box in the geohash grid. That grid varies in size wildly based on the precision. Take a look at the chart I linked to before - going from precision 6 to 7 is the difference of a horizontal size of ~1200m down to ~150m. That's a huge difference with just a single level of precision.

What's happening is that when you are zoomed out, the precision is low, so the grid size is large, and likely covers Pakistan, Afghanistan and northern and maybe even central India, and the center of that specific grid just happens to be in Pakistan. The point itself may be anywhere in that grid, but the dot you see on the tile map is just placed in the center of the very large geohash grid.

As you zoom in and increase the precision, the grid sizes get smaller, so now the center of the grid that contains your geopoint is much closer to the actual location of that geopoint.

This image is a decent representation of what you see happening:


On the left, you see that the precision is low, and the grid is very large, covering New York City as well as a large chunk of New Jersey. If the point was actually in NYC, it would still land in that grid, and be represented as a point in the center of that grid, which makes it look like it's out in the ocean off the coast of New Jersey. On the right, the precision is increased, and the grid size is smaller, so a point that is actually in NYC looks more correct, as the center of the grid it's in happens to be very close to NYC.

Hi joe,

Its clear that its making geo hash grid. If i have a lat long 28.7774 , 77.465678 and for precision 6 I have to calculate the Geo hash grid center. How I can get the geohash grid coordinates or the center of the grid?

Thanks for all your replies and Its very clear for me, Now I am able to understand the logic of the Kibana from your replies.

Sandeep Kumar

Hi joe,

Please help me out. How will I draw my circle for a bucket in GeoHash Grid Aggregation. I want to draw circle for each bucket from which location I have to draw my circle. Please help ..

Sandeep Kumar

That, I'm not really sure. Elasticsearch does this internally, we just use the results we get back and put them on the map. So, if that point is in Elasticsearch, and you do a Geohash Aggregation, then it's all handled for you, and the results will be bucketed by the grid, with the center point of that bucket being the center of the grid.

If you're trying to use Geohash coordinates in your own application code, it's a standard, so there most likely exists a number of libraries you can use.