-
Notifications
You must be signed in to change notification settings - Fork 405
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
#8597 Simplifying query params #8617
#8597 Simplifying query params #8617
Conversation
Support of delayed execution of mapInfo request upon layer added via query parameters
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.
I tested the functionality and it works quite well.
I noticed something that should be improved in doc and specification, moreover some syntax issue that we didn't noticed during the planning.
- You used in the example the separator
|
instead of;
. I see the application manage both. I think we should manage only one to avoid confusion or possible overlaps with reserved chars. both;
and|
do not seems to be used in CQL, but|
is less common to find in many keyboards, while;
is easier. For this reason I should use only;
. Anyway we have some problems with some special chars, so see comments below. - I noticed during the review that both "layer names" and "cql_filters" may contain
,
and cql_filter can contain"
chars. Here we are using these chars to separate values.
@alex-fko followed the specification correctyl but we have to decide what to do to avoid issues.
In particular
- ,
in layer names can be send to WMS to require more than one layers in the same call overlapped
- ,
in cql_filter are used in filters IN
- "
in cql_filter are used to specifiy attribute names and it is needed when these names have speces. E.g. the attribute filter FEATURE SIZE = 1 is not valid. While "FEATURE_SIZE" = 1 is the correct syntax.
Alternative solutions should include complex escaping strategies that may make the syntax and the code more complex.
Proposed changes
I propose to change:
|
to separate layers and cql_filters.|
is not present in ecql specification (or at least I couldn't find it), while ";" is persent, and for consistency with the syntax, we should use the same separator for layers and filters.;
to separate layer name and service"
remove initial and final"
in the filters in the original proposal, that are unnecessary and overlap with the cql_sintax.
@tdipisa @alex-fko please let me know your opinion about it.
- I also added some changes to the doc in general, to clarify more the usage and to correct generated doc indentation. please apply my changes (and check them on the generated doc).
@offtherailz let's have a call tomorrow to check this together please. |
As far as the separator for layers is concerned I don't see any reason to use
ok with this, only
Ok, if it is not necessary we can remove |
Co-authored-by: Lorenzo Natali <lorenzo.natali@geosolutionsgroup.com>
Updated documentation.
@tdipisa @offtherailz So now: Double quotes are removed from examples in documentation. |
@alex-fko cql_filter syntax contains So summarising:
Unfortunately this is the only syntax that doesn't requre escaping. It is a little asymmetric but I can not imagine a different solution.
So we have to separate also cql_filters with |
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.
Please use ";" as separator for cql_filters and update the examples in the PR to test as asked.
,
is reserved for cql
;
is used, but only to separate conditions ( filter expressions ) that is exactly the usage we are having now. Also geoserver allows this this way.
Reference:
https://github.com/geotools/geotools/blob/main/modules/library/cql/ECQL.md
web/client/utils/QueryParamsUtils.js
Outdated
if (parsed.length) { | ||
const defaultSource = selectedServiceSelector(state); | ||
const pairs = parsed.map(el => el.split(";")); | ||
const layerFilters = (parameters.layerFilters ?? '').split(',') ?? []; |
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.
we should use ";". "," is reserved in cql.
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.
Thanks, updated it
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.
Please update the description (and/or the issue) to make it testable from the test team.
Description is updated, here is the complex example that might be useful to test changes on dev: |
@ElenaGallo please test this in DEV and let us know if we can backport to 2022.02.xx |
Test passed on DEV, @alex-fko please backport to 2022.02.xx. Thanks |
(cherry picked from commit 382c3f1)
(cherry picked from commit 382c3f1)
Description
Part of the query parameters have a complex syntax and may be hard to use by end-user.
This PR updates existing and add new query parameters with simple syntax.
featureInfo
parameter got a simple syntax:#/viewer/openlayers/new?featureInfo=38.72,-95.625
where lat and lng are comma-separated values.mapInfo
parameter allows to useSEARCH_LAYER_WITH_FILTER
action upon specific layet to get feature info based on filter criteria:#/viewer/openlayers/new?addLayers=tiger:poly_landmarks;gs_stable_wms&mapinfo=tiger:poly_landmarks&mapInfoFilter=CFCC='H41'
mapInfoFilter
in this case is a supplementary parameter to pass cql filter in it.Previously it was not possible to trigger
SEARCH_LAYER_WITH_FILTER
on a layer that is added via query parameters. Now if bothaddLayers
andmapInfo
parameters present in a query string, app will compare name of layer inmapInfo
and will delay search execution whenever layers is also listed inaddLayers
. Example above will delay search execution becausetiger:poly_landmarks
is in both parameters.addLayers
is equivalent ofADD_LAYERS_FROM_CATALOGS
action:#/viewer/openlayers/new?addLayers=tiger:poly_landmarks;gs_stable_wms,tiger-ny;gs_stable_wms&layerFilters=CFCC='H41'
layerFilters
is a supplementary parameter to pass cql filter applied upon layer addition.background
allows to dynamically add background to the map and activate it. Supports default backgrounds provided by static service defined inlocalConfig.json
(default_map_backgrounds
) as well as other layers:#/viewer/openlayers/new?background=Sentinel
#/viewer/openlayers/new?background=tiger-ny;gs_stable_wms
Please note that default service for
background
isdefault_map_backgrounds
. Based on the selection criteria for this service it is enough to pass desired layer name even partially, e.g.background=Sen
, it will use first layer matching search criteria.All parameters from now on support both
camelCase
andlowercase
, e.g.addLayers
andaddlayers
.Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x", remove the others)
Issue
What is the current behavior?
#8597
What is the new behavior?
Existing parameters syntax is updated according to proposal.
New parameters are added (
mapInfo
,background
,addLayers
).Added support of having
mapInfo
processor applied to the dynamically loaded layer (viaaddLayers
)Breaking change
Does this PR introduce a breaking change? (check one with "x", remove the other)
Other useful information