Support for GeoJSON with 4-Component Coordinates and Dynamic Height Selection via modelMatrix #9553
Unanswered
FrancicoVerdu
asked this question in
Q&A
Replies: 1 comment 2 replies
-
|
Can you use 2 different geojsonlayers , 1 for each z and toggle between them? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working with GeoJSON data where each point has 4 components in its coordinates, for example: [x, y, z_relative, z_absolute]. My goal is to visualize these points in deck.gl so that, based on a configuration variable, either the relative or absolute height is used. I want to achieve this without preprocessing the data on the CPU—using GPU transformations instead by leveraging the modelMatrix property to "convert" the 4-component vector into a 3-component one by swapping or selecting between the third and fourth components.
I've encountered several challenges with this approach:
Limitations of GeoJsonLayer: The GeoJsonLayer automatically extracts positions from the GeoJSON geometries, which means I cannot define a custom getPosition accessor. This prevents me from selecting between the third and fourth components at the layer level.
Using modelMatrix for Transformation: My idea was to apply a transformation using a 4x4 matrix (for instance, a "swap matrix" that exchanges the third and fourth components) so that the desired value is placed in the height position used by the shader.
Question: Is it possible to use only the modelMatrix property in deck.gl to perform the necessary transformation so that, based on a configuration variable, either the relative or absolute height is selected for a GeoJSON with 4-component coordinates?
Beta Was this translation helpful? Give feedback.
All reactions