Skip to content

Get all visible pixels as array or data url #140

Open
@divyaaaaaa

Description

@divyaaaaaa

Is your feature request related to a problem? Please describe.
I want to be able to get the screen grab of visible pixels in the layer and pass it for let's say Machine Learning Inference. It would be nice if there a was direct toDataUrl giving all the visible pixels.

Currently, it looks very difficult to obtain, slice and stitch values from getActiveTiles.

Describe the solution you'd like
A toDataUrl or getPixelArray kind of function to give me the values. I'm relatively new to JS, but seems if pixels are visible on Canvas, they might as well be extracted.

Describe alternatives you've considered
Solution I am trying currently is to use getActiveTiles, slice to canvas extent and concatenate all the tiles.
An alternative is to use getValues, but that too would need some stitching.
Another alternative, not very relevant here, is I'm planning to use rasterio based python service in the backend, which would bring unacceptable latency.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions