question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Square/Hexbin aggregation

See original GitHub issue

Context

For squares/hexbins aggregation, Builder takes a bin size based on the zoom level at the moment of the map creation. After that, the bin size remains static regardless of the zoom level.

The current query to create those maps is:

SELECT 
  CDB_HexagonGrid ( 
    ST_Expand(
      !bbox!, 
      CDB_XYZ_Resolution(ZOOM_LEVEL) * 12), 
    CDB_XYZ_Resolution(ZOOM_LEVEL) * 12) 
  AS cell

while in the Editor it was:

SELECT 
  CDB_HexagonGrid(
    ST_Expand(
      !bbox!, 
      greatest(!pixel_width!,!pixel_height!) * 24), 
    greatest(!pixel_width!,!pixel_height!) * 24) 
  AS cell

Steps to Reproduce

  1. Create a map with a point’s dataset
  2. Select squares or hexbins aggregation and set a size
  3. Zoom in/out

Current Result

The map is instantiated with a fixed bin size based on the initial zoom level, so the grid doesn’t change at different zoom levels

Expected result

Bins should resize on each zoom level according with the pixel size value used as a parameter.

Additional info

If we decide to have a fixed bin size, we should use a different unit than pixels for setting it, like meters.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jgoizuetacommented, Feb 7, 2018

I find the present implementation inconsistent in that users define the grid size in pixels (screen units) but the grid is actually set in geographic units (onscreen size changes with zoom, size is earth-relative actually as @ernesmb notes).

But I think there might be use cases for both the current behaviour and the previoius one. What I’d like to see is an option in the UI to choose the grid size units:

  • If meters (km, etc) are selected, the gridding is earth-wise (as now, pixel size will change with zoom)
  • If pixels are selected, the grid is screen-wise (earth-relative size in meters will change with zoom)

Just my 2c.

0reactions
ramiroaznarcommented, Feb 19, 2018

Let’s close this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Geohex grid aggregation | Elasticsearch Guide [8.5] | Elastic
A multi-bucket aggregation that groups geo_point values into buckets that represent a grid. The resulting grid can be sparse and only contains cells...
Read more >
Aggregation Functions - Apache Pinot Docs
Function Description Exam... ​COUNT​ Returns the count of the records as Long COUN... ​DISTINCTCOUNTTHETASKETCH​ See Cardinality Estimation​ ​ ​DISTINCTCOUNTRAWTHETASKETCH​ See Cardinality Estimation​ ​
Read more >
GeoHex grid aggregations - OpenSearch documentation
GeoHex grid aggregations. The Hexagonal Hierarchical Geospatial Indexing System (H3) partitions the Earth's areas into identifiable hexagon-shaped cells.
Read more >
The wild power of aggregation theory - YouTube
How did Google, Amazon, and Facebook get so big so fast? The best answer we have is an idea called Aggregation Theory. This...
Read more >
Aggregation with Feature Detection - Xiaojuan Qi
Aggregating features from different depths of a network ... which actually makes the feature aggregation happen in all these networks.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found