Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scatterplot layer: Radius updates #238

Closed
MoritzStefaner opened this issue Nov 30, 2016 · 8 comments
Closed

Scatterplot layer: Radius updates #238

MoritzStefaner opened this issue Nov 30, 2016 · 8 comments

Comments

@MoritzStefaner
Copy link

MoritzStefaner commented Nov 30, 2016

Hi,

I am observing the following problems when trying to update the radius of elements in the Scatterplot layer:

    updateCount++;
    let getScatterplot = ()=>{
      return new ScatterplotLayer({
        id: 'scatter-plot',
        data: scatterPlotData || [],
        getPosition: d => [d.lon, d.lat, d.elevation],
        getColor: d => [Math.floor(Math.random()*255), Math.floor(Math.random()*255), Math.floor(Math.random()*255)],
        getRadius: d => Math.random() * 10,
        updateTriggers: {
          instanceColors: {updateCount},
          instanceRadius: {updateCount}
        }
      });
    }

throws:

"AssertionError: undefined == true
    at AttributeManager.invalidate (http://localhost:8080/js/app.js:189025:29)
    at ScatterplotLayer._diffUpdateTriggers (http://localhost:8080/js/app.js:188791:31)
    at ScatterplotLayer.diffProps (http://localhost:8080/js/app.js:188695:15)
    at LayerManager._updateLayer (http://localhost:8080/js/app.js:190290:33)
    at LayerManager._matchSublayers (http://localhost:8080/js/app.js:190137:21)
    at LayerManager._updateLayers (http://localhost:8080/js/app.js:190089:25)
    at LayerManager.updateLayers (http://localhost:8080/js/app.js:189910:34)
    at DeckGL._updateLayers (http://localhost:8080/js/app.js:149339:13)
    at DeckGL.componentWillReceiveProps (http://localhost:8080/js/app.js:149321:13)
    at http://localhost:8080/js/app.js:31672:24"

(Visually, the example changes the colors of the dots, on each draw, but not the radii.)

Any ideas?

@ibgreen
Copy link
Collaborator

ibgreen commented Nov 30, 2016

@MoritzStefaner You were getting this error because the 32 bit ScatterplotLayer did not have an instanceRadius attribute (radius was encoded inside instancePositions).

The referenced PR updates the code to generate better errors when referencing undefined attributes in updateTriggers, and updates ScatterplotLayer(32) to have same attributes as ScatterplotLayer64, including instanceRadius. This should fix the issue.

@MoritzStefaner
Copy link
Author

Ah, that makes sense! Thanks for the swift reply!

ibgreen added a commit that referenced this issue Nov 30, 2016
…240)

* Make shaders customizable. Scatterplot32 instanceRadius, fixes #238.

* Fix travis tests
@MoritzStefaner
Copy link
Author

Thanks! Might be another issue, but I updated to 3.1.0 now, and get the following warnings / errors:

warning.js:36Warning: Failed prop type: Cannot call a class as a function
    in DeckGL (created by Motion)
    in Motion (created by MapView)
    in MapView (created by App)
    in div (created by App)
    in App

log.js:54Program scatter-plot-program: Attribute 2:instancePositions not supplied

(layer definition is same as above) - any ideas? Has the API changed?

@ibgreen
Copy link
Collaborator

ibgreen commented Dec 1, 2016

#244 landed last night, fixes the instancePositions issue. Will be published today.

@ibgreen
Copy link
Collaborator

ibgreen commented Dec 1, 2016

The warning looks like a React PropTypes mixup. Will take a look.

@ibgreen
Copy link
Collaborator

ibgreen commented Dec 1, 2016

@MoritzStefaner 3.1.1 published, give it a try.

@jefffriesen
Copy link

I ran into the same problem and this fixed it. Thanks.

@MoritzStefaner
Copy link
Author

@ibgreen Works fine now, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants