Git Product home page Git Product logo

Comments (13)

ibgreen avatar ibgreen commented on April 28, 2024

@contra - Correct. The projection shaderlib now enables all layers to work in both meters and lng/lat, and this also enabled us to specify extents in meters, so we tried that.

As you say it is of course also sometimes desirable to specify extents in pixels, but there is no prebuilt mechanism for doing this yet - it will require a touch of hand coding in the vertex shader.

I've not quite made up my mind what I think is the best approach. I was leaning towards preferring to have radius specified in meters, while allowing the app to specify a minimum pixel size for the point using a prop... that should be pretty easy to add to the current layer. What do you think?

from deck.gl.

yocontra avatar yocontra commented on April 28, 2024

@ibgreen Size in meters with min/max pixel size solves all of my use cases. Biggest issue right now is being zoomed way out and having the dots be non-existent, and zooming way in and having them consume 50% of the viewport.

from deck.gl.

yocontra avatar yocontra commented on April 28, 2024

How does all of this play in with strokeWidth for choropleth/arc/line? Is the plan to move those to the same system as well?

from deck.gl.

ibgreen avatar ibgreen commented on April 28, 2024

strokeWidth is a little harder to change, since it currently uses gl.lineWidth which is specified in screen pixels.

We do have an enhanced-choropleth-layer that extrudes lines to thin triangle strips and yes this gives us that level of control (an also allows us to get clean "mitering"), so it is probably the way to go (i.e. eventually replace choropleth-layer with enhanced-choropleth-layer)

from deck.gl.

yocontra avatar yocontra commented on April 28, 2024

@ibgreen Would that work for arcs too?

from deck.gl.

ibgreen avatar ibgreen commented on April 28, 2024

Would that work for arcs too?

Arcs require 3D extrusion (think a thin "tube" rather than just a flat strip), so we need to create more triangles, and mitering (joining) tubes requires a bit more care than joining flat strips. But yes, we could absolutely have a layer that "tessellates" arcs.

from deck.gl.

yocontra avatar yocontra commented on April 28, 2024

Couple of examples with 3.x:

There's 25K dots on this map, but none of them are visible due to the scaling.

image

Zooming in more makes them kind of visible, but still way too small.

image

Zoom in a little bit more and they become huge.

image

from deck.gl.

ibgreen avatar ibgreen commented on April 28, 2024

@contra There are two ways to set the radius - getRadius accessor returns radius in meters of that particular point (default 1) and radius is a multiplier (default 30).

You can make them visible in the zoomed out mode by making the radius bigger, but they will of course become even bigger as you zoom in.

We could change the layer to work differently, or have more options - we just need to agree on how we want it to work.

  • Do you want the points to always occupy a certain number of screen pixels, regardless of zoom?
  • Would you like to be able to specify min and max sizes for them?
  • etc...

from deck.gl.

yocontra avatar yocontra commented on April 28, 2024

@ibgreen How do you feel about this? Feels a little funny mixing units but can't think of any other way.

new ScatterPlot({
  radius: 3, // meters
  minRadiusPixels: 10 // pixels
  maxRadiusPixels: 20 // pixels
})

This solves all of the cases.

from deck.gl.

ibgreen avatar ibgreen commented on April 28, 2024

@contra - Yes this looks reasonable.

  • Maybe radiusMinPixels etc in case we need to specify screen size limits on multiple props.
  • These props could default to 0 and say 10000 (something big enough to cover today's screens).

from deck.gl.

yocontra avatar yocontra commented on April 28, 2024

Will work on a PR, hopefully I can do this without having to mess with the shaders - no idea how to work on that stuff.

from deck.gl.

ibgreen avatar ibgreen commented on April 28, 2024

@contra Looking forward to the PR, but I do suspect it needs to be done in the shaders.

You need to make sure the props get set as uniforms when they change, declare the new uniforms in the vertex shader, then clamp the intermediate scaled radius value in the shader.

You can always give it a try - it should be easy to just extend the existing code - and I have seen several people here getting hooked on shader programming after having their first ever go at modifying an existing deck.gl layer.

If not - maybe you can put together some of those layer docs we talked about, and I could give this a whirl :)

from deck.gl.

mcnuttandrew avatar mcnuttandrew commented on April 28, 2024

I wanna plus one @ibgreen suggestion to modify the radius. I've have reasonably good success with correlating the zoom level the radius multiplier level

from deck.gl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.