-
Notifications
You must be signed in to change notification settings - Fork 162
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 Custom Colormap querystring option #262
Conversation
def ColorMapParams( | ||
color_map: ColorMapName = Query(None, description="Colormap name",) | ||
colormap_name: ColorMapName = Query(None, description="Colormap name"), | ||
colormap: str = Query(None, description="JSON encoded custom Colormap"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
breaking change
return cmap.get(colormap_name.value) | ||
|
||
if colormap: | ||
return json.loads( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also accept base64 encoded string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
neither are great, but I think base64 is less weird than JSON for get requests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another way maybe would be to pass a list of value like
colormap=1,#FFFF00&colormap=2,#FF00FF
#equivalent of
colormap={"1": "#FFFF00", "2":"#FF00FF"}
following some discussion on slack, Right now a user could define a discrete colormap by passing a JSON encoded object in form of
I understand that this is quite uncommon for GET request to receive we need a way to pass a
Options
👂 |
Note: the |
Option 1JSON encoded object {note: would need to be decoded and re-encoded in tilejson endpoint)
Option 2base64 encoded dict (seems to be a nice option but pretty custom)
Option 3List defined colormap value (restricted to hex color definition and custom key/color 1,#fff form)
I think it's fine to go with option 1. It's not the best solution but:
Notes:
which will 💯 match the specs but still really verbose and not as |
closes #153
This PR does:
color_map
query parameter tocolormap_name
colormap
option.The
colormap
option accepts JSON encoded object in form of:the
{RBG(A)}
value can either be a list of R,G,B (and Alpha) values or an hex color representationcc @kylebarron @blazetopher