Skip to content

Vector tiles POC#2

Open
honzaflash wants to merge 8 commits into
mainfrom
vector-tiles
Open

Vector tiles POC#2
honzaflash wants to merge 8 commits into
mainfrom
vector-tiles

Conversation

@honzaflash

Copy link
Copy Markdown
Collaborator
  • add support for multiple layers in GetMap
    • execute existing logic sequentially for each DataArray (each layer)
      • likely not optimal for performance but easy enough to implement for a proof of concept
  • add an alternate style that produces identical output to raster/arrows except it uses two layers with u and v vector components

- move the mesh generation and shading from `render` body to their own methods and refactor small things
  - also use autoscale when `colorscalerrange` is `None` for type checker's sake even though
    validation ensures this happens only when `autoscale` is `True`
- fix an overly narrow type hint (caused type error elsewhere)
- move styles related query parameter processing to its own function too and refactor a little
@honzaflash
honzaflash force-pushed the vector-tiles branch 2 times, most recently from 7d85f18 to 7c099b9 Compare March 16, 2026 23:14
@honzaflash
honzaflash force-pushed the vector-tiles branch 3 times, most recently from 3ad2610 to f8e6a6b Compare March 24, 2026 18:15
- get_map.py was getting long so move it into a submodule
- update the GetMap query model
  - add new `styles` for vector visualizations (`vector-arrow/*`,
    `vector-arrow-color/*`)
  - add `color` and `density` parameters (intended mainly for vectors)
- add support for multiple layers in GetMap
  - split layer string on ',' and process a list of layers instead of a single layer
  - execute existing logic sequentially for each DataArray (each layer)
    - this is likely not optimal for performance but easy enough to implement for a proof of concept
- add new vector styles that use two layers (assumes layers are u, v components)
  - options for a magnitude colormap background with normalized vector arrows,
    and normalized vector arrows colored by magnitude
- implement `get_minmax` for vectors
  - treat multiple layers as a pair of vector components
  - for vector layers, get min/max from their magnitude
- refactor GetMap to store output style options nested in a dict
  instead of flat as attributes of GetMap
  - this way the class isn't polluted by attributes not relevant
    to the used rendering style
  - type checker can infer stuff based on the discriminator field (`styles.type`)
- add tests for new GetMap styles
  - test query parameter parsing for the vector and colormap style options
- refactor how GetMap handles minmax request
- move minmax computation out of the render method
- and centralize it in the get_minmax method
- not actually sure why the try-catch wrapped line is the one raising
  the error but it seems like it is (must be some laziness)
- if error happens for a vector layer, try to compute a ceiling max
  based on max values of the vector components
- before the layer metadata endpoint would return the single elevation value instead of a list as expected
  - if there is only one elevation value the retrieved elevations
    is a 0-dim array and using `.tolist()` on it would turn it into
    a plain float instead of a list
- now we convert the 0 dimensional array of elevations to a 1D array
- and when selecting by elevation we return the input DataArray early
  because there is nothing to select

  because of the varible being scalar
- refactor the pydantic query model to validate and parse the layer names
- refactor get_metadata function to handle the list of layers
- implement layerdetails for multiple layers/pair of vector layers
- support timesteps for vector layers (return time steps of first layer)
- remove redundant logic
- then remove unused parameters and imports
- make layers query parameter optional (it's not currently used)
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

Successfully merging this pull request may close these issues.

1 participant