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.

Hexagons rendered at (0, 0)

See original GitHub issue

Issue

I’m trying to recreate the hexagon example, but the hexagons aren’t being rendered at the correct locations.

The data is the road accidents in the UK as per

data = {
  return d3.csv('https://raw.githubusercontent.com/uber-common/deck.gl-data/master/examples/3d-heatmap/heatmap-data.csv', row => {
    return {lng: +row.lng, lat: +row.lat};
  })

Actual Result

In this screenshot I’m showing two layers - a scatterplot and a hexagon

screen shot 2018-07-23 at 12 40 30 pm

The scatterplot has rendered as expected - the blue dots over the UK

The hexagons have rendered at coordinates (0, 0) (you can see a small blue dot at location (0, 0) off the central-east coast of Africa at the bottom of the image), and I don’t know why.

If it helps, this is the log of the hexagon and scatterplot layers

screen shot 2018-07-23 at 12 50 11 pm

Code Example

The two functions I’m using to create the hexagon and scatterplots are:

const hexagonLayer = new deck.HexagonLayer({
  id: 'hexagon'
  data,
  pickable: true,
  extruded: true,
  elevationRange: [0, 1000],
  elevationScale: 250,
  opacity: 1,
  getPosition: d => [d.lng, d.lat]
});
const scatterLayer = new deck.ScatterplotLayer({
  id: 'scatterplot',
  data,
  radiusScale: 1,
  radiusMinPixels: 1,
  getRadius: d => d.radius,
  getPosition: d => [d.lng, d.lat],
  getColor: d => hexToRgb( d.fill_colour )
});

Both functions are using the same getPosition: d => [d.lng, d.lat] function, and receive the same data object.

Background / extra detail

I’m an R programmer, not a javascript programmer, so I may have missed something obvious.

I’m making an R package (github repo here) which wraps deck.gl. Therefore my js functions are slightly different to the examples, as I have to receive the data from R.

The hexagon.js is here

The scatterplot.js is here

To Do List

  • Add label and assign to milestone
  • Coding
  • Test

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:18 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
ollercommented, Oct 24, 2018

Wahey! Works for me in 6.2.1!

Thanks again for all your efforts with this lib!

1reaction
SymbolixAUcommented, Oct 19, 2018

Same issue in v6.2.0 of deckgl.min.js

Read more comments on GitHub >

github_iconTop Results From Across the Web

Noisy hex rendering - Red Blob Games
0. The first key idea is that it's easier to make interesting boundaries when you move them into the center of what you're...
Read more >
How to Render a Hex Grid - Stack Overflow
I am currently working on a game that requires a hexagon grid to be rendered in order to provide a place for ...
Read more >
Hexagons and Beyond: Flexible, Responsive Grid Patterns ...
Making a grid of hexagons. First, we create our hexagon shape. This task is fairly easy using clip-path . We will consider a...
Read more >
H3 Tutorial: Rendering Hexagons / taha turk - Observable
There are a variety of different ways to render H3 hexagons on a map. This tutorial demonstrates a simple approach to rendering an...
Read more >
Correctly render multiple hexagons on Mapbox
I have a GeoJSON of hex indexes, which I am trying to render on to ... This is how the GeoJSON looks when...
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