Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add metadata model #38

Merged
merged 5 commits into from
Feb 24, 2022
Merged

add metadata model #38

merged 5 commits into from
Feb 24, 2022

Conversation

vincentsarago
Copy link
Member

@vincentsarago vincentsarago commented Feb 22, 2022

ref #30

This PR adds a SearchMetadata model defining the mosaic metadata that could be provided by the user when registering a search request.

Metadata

{
    // OPTIONAL. Default: "mosaic" (No other value accepted for now). Describe the `type` of metadata. 
    "type": "mosaic",

    // OPTIONAL. Default: null.
    // The maximum extent of available map tiles. The bounds are represented in WGS:84
    // latitude and longitude values, in the order left, bottom, right, top.
    // Values may be integers or floating point numbers.
    "bounds": [ -180, -85.05112877980659, 180, 85.0511287798066 ],

    // OPTIONAL. Default: null.
    // An integer specifying the minimum zoom level.
    "minzoom": 0,

    // OPTIONAL. Default: null.
    // An integer specifying the maximum zoom level. MUST be >= minzoom.
    "maxzoom": 11,

    // OPTIONAL. Default: null. The name can contain any legal character.
    "name": "compositing",

    // OPTIONAL. Default: null. An array of available assets.
    "assets": ["image", "cog"],

    // OPTIONAL. Default: null. A set of `defaults` configuration.
    "defaults": {
        "true_color": {
            "assets": ["B4", "B3", "B2"],
            "color_formula": "Gamma RGB 3.5 Saturation 1.7 Sigmoidal RGB 15 0.35",
        },
        "ndvi": {
            "expression": "(B4-B3)/(B4+B3)",
            "rescale": "-1,1",
            "colormap_name": "viridis"
        }
    }
}

@vincentsarago vincentsarago self-assigned this Feb 22, 2022
@vincentsarago vincentsarago changed the title [Work In Progress] add metadata model [PROPOSAL] add metadata model Feb 22, 2022
exclude_none=True,
exclude={"metadata"},
by_alias=True,
)
metadata = body.metadata or {}
return search, metadata
return model.PgSTACSearch(**search), body.metadata
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: @drnextgis

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! As soon as it is merged, I will update the example in the documentation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏 , for now I'm still waiting for some feedback on the metadata model

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class RegisterMosaic(PgSTACSearch):
"""Model of /register endpoint input."""

metadata: Metadata = Field(default_factory=Metadata)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metadata will always be set when registering a search with the RegisterMosaic. default metadata should be {"type": "mosaic"}

@drnextgis
Copy link
Contributor

Looks good to me. Just one question: what is the purpose of having SearchType.search?

@vincentsarago
Copy link
Member Author

@drnextgis

what is the purpose of having SearchType.search?

I guess my goal is to quickly differentiate search requests registered through titiler-pgstac and other search entries. This way when we do #40 we can only filter on type=="mosaic". the type SearchType.search will be set by default for search entries that doesn't have the type SearchType.mosaic (not used for now, but maybe later)

@vincentsarago vincentsarago changed the title [PROPOSAL] add metadata model add metadata model Feb 24, 2022
@vincentsarago
Copy link
Member Author

FYI: I'm going to merge this to Master, but anyone interested can still make comments over #30

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.

2 participants