Skip to content

Masking one raster based on a values in a different raster #780

Answered by vincentsarago
scottstanie asked this question in Q&A
Discussion options

You must be logged in to vote

@scottstanie this is a nice use case, sadly there is no direct ways to do this without either using a custom Reader and a custom path_dependency, or a custom dependency and full custom endpoint.

a custom reader could look like this

from typing import Any, Dict, List, Type, TypedDict, Optional
import contextlib

import attr
from rasterio.crs import CRS
from morecantile import TileMatrixSet
from rio_tiler.constants import WEB_MERCATOR_TMS, WGS84_CRS
from rio_tiler.io import BaseReader, Reader
from rio_tiler.types import BBox, Indexes
from rio_tiler.models import BandStatistics, ImageData, Info, PointData

class Input(TypedDict, total=True):
    """Reader Options."""

    data: str
    mask: s…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@scottstanie
Comment options

@vincentsarago
Comment options

@scottstanie
Comment options

Answer selected by scottstanie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants