more parameter settings are required for algorithms endpoints #760
Replies: 1 comment 3 replies
-
@JinIgarashi I'm not quite sure to fully understand, to you have an example? titiler/src/titiler/core/titiler/core/algorithm/dem.py Lines 12 to 23 in 70c18b3
everything comes from https://github.com/developmentseed/titiler/blob/main/src/titiler/core/titiler/core/factory.py#L1654C30-L1654C64 (pydantic method) HillShade.model_json_schema()["properties"]
{'input_nbands': {'default': 1, 'title': 'Input Nbands', 'type': 'integer'},
'output_nbands': {'default': 1, 'title': 'Output Nbands', 'type': 'integer'},
'output_dtype': {'default': 'uint8',
'title': 'Output Dtype',
'type': 'string'},
'output_min': {'anyOf': [{'items': {}, 'type': 'array'}, {'type': 'null'}],
'default': None,
'title': 'Output Min'},
'output_max': {'anyOf': [{'items': {}, 'type': 'array'}, {'type': 'null'}],
'default': None,
'title': 'Output Max'},
'azimuth': {'default': 90, 'title': 'Azimuth', 'type': 'integer'},
'angle_altitude': {'default': 90.0,
'title': 'Angle Altitude',
'type': 'number'},
'buffer': {'default': 3, 'title': 'Buffer', 'type': 'integer'}} in your custom algorithm, if you see min/max value for a properties using Pydantic from titiler.core.algorithm.base import BaseAlgorithm
from pydantic import Field
from rio_tiler.models import ImageData
class Something(BaseAlgorithm):
# parameters
yo: int = Field(90, ge=0, lt=100)
def __call__(self, img: ImageData) -> ImageData:
return img
Something.model_json_schema()["properties"]
{'input_nbands': {'anyOf': [{'type': 'integer'}, {'type': 'null'}],
'default': None,
'title': 'Input Nbands'},
'output_nbands': {'anyOf': [{'type': 'integer'}, {'type': 'null'}],
'default': None,
'title': 'Output Nbands'},
'output_dtype': {'anyOf': [{'type': 'string'}, {'type': 'null'}],
'default': None,
'title': 'Output Dtype'},
'output_min': {'anyOf': [{'items': {}, 'type': 'array'}, {'type': 'null'}],
'default': None,
'title': 'Output Min'},
'output_max': {'anyOf': [{'items': {}, 'type': 'array'}, {'type': 'null'}],
'default': None,
'title': 'Output Max'},
'yo': {'default': 90,
'exclusiveMaximum': 100,
'minimum': 0,
'title': 'Yo',
'type': 'integer'}}
Again I'm not sure to get this, but have to use JSON encoded parameters for algorithm because we need |
Beta Was this translation helpful? Give feedback.
-
Currently titiler's algorithms api returns parameters with
default
,title
andtype
only. It would be nice if the api can return more settings for parameters such asmaxValue
,minValue
. If these settings are available, it is easier to make slider UI for parameters.In addition, in default example of algorithms, there is not string parameters. it would be nice if option values can be included in parameter settings (like for making selecting box) if it is string type.
There additional parameter settings can be useful if frontend side want to build a UI dynamically.
Beta Was this translation helpful? Give feedback.
All reactions