Opened 6 months ago

Last modified 2 weeks ago

#1490 assigned feature

Support wcpsTransformQuery in WMS InsertStyle requests

Reported by: dmisev Owned by: bphamhuu
Priority: major Milestone: 9.5
Component: petascope Version: development
Keywords: Cc: vmerticariu, bphamhuu
Complexity: Medium

Description (last modified by dmisev)

Users wanting to use rasqlTransformFragment in WMS are not typically familiar with rasql.

I propose to implement a tool for them, that given a WCPS query will generate a corresponding rasql fragment that can be used for a WMS style.

It could be part of the WCS client for example, ProcessCoverages tab (or WMS tab)? The tool translates WCPS to rasql, substitutes the coverage variable with $Iterator and removes the select and from ... parts from it.

Alternatively, a better/cleaner way: support wcpsTransformQuery parameter in the InsertStyle? request? Internally this can be translated to rasql I guess.

Change History (18)

comment:1 Changed 6 months ago by dmisev

  • Cc bphamhuu added
  • Description modified (diff)
  • Owner changed from bphamhuu to dmisev
  • Status changed from new to assigned
  • Summary changed from Generate rasqlStyleFragment for WMS from WCPS query to Generate rasqlTransformFragment for WMS from WCPS query

It's assigned to me until we decide how/where to put this.

comment:2 Changed 6 months ago by dmisev

Perhaps a better/cleaner way: support wcpsTransformQuery parameter in the InsertStyle request? Internally this can be translated to rasql I guess.

What do you think?

comment:3 Changed 6 months ago by bphamhuu

I prefer not to touch WCS client as this is quite complex to make any new feature, your later solution seems better.

comment:4 Changed 3 months ago by dmisev

  • Description modified (diff)
  • Milestone changed from 9.4 to 9.5
  • Summary changed from Generate rasqlTransformFragment for WMS from WCPS query to Support wcpsTransformQuery in WMS InsertStyle requests
  • Type changed from defect to feature

comment:5 Changed 2 weeks ago by bphamhuu

ok, so it will use the WCPS query as a part of insertStyle request. To determine that it is WCPS query instead of rasqlTransformFragment query,

service=WMS&
version=1.3.0&
request=InsertStyle&
name=FireMarkup&
layer=test_wms_4326&
abstract=This style marks the areas where fires are in progress with the color red&
rasqlTransformFragment=case $Iterator when ($Iterator + 2) > 20 then {255,0,0} when ($Iterator + 5 + 25 - 25)  > 10+5 then {0,255,0} when (2+$Iterator+0.5-0.25*(0.5+5)) < 10-5+2 then {0,0,255} else {0,0,0} end

it should use another parameter wcpsQuery=

service=WMS&
version=1.3.0&
request=InsertStyle&
name=FireMarkup&
layer=test_wms_4326&
abstract=This style marks the areas where fires are in progress with the color red
&wcpsQuery=for c ....

As it needs to keep backward compatibility.

comment:6 Changed 2 weeks ago by bphamhuu

  • Owner changed from dmisev to bphamhuu

comment:7 follow-up: Changed 2 weeks ago by dmisev

Better wcpsQueryFragment (consistency with rasqlQueryFragment).
The rasql query fragment doesn't have any select .. part, so the wcps query shouldn't have for c in ... either I suppose.

comment:8 in reply to: ↑ 7 Changed 2 weeks ago by bphamhuu

Replying to dmisev:

Better wcpsQueryFragment (consistency with rasqlQueryFragment).
The rasql query fragment doesn't have any select .. part, so the wcps query shouldn't have for c in ... either I suppose.

What we should do is reduce the kind of learning new query style for users. The rasqlQueryFragment is kind of weird syntax and therefore, it should be deprecated and use the syntax of WCPS as this is the only query syntax user will need to learn to use in Petascope. So, we shouldn't make it complicated by chopping the syntax both for user and developer as this is not a valid WCPS syntax to parse to Rasql.

comment:9 follow-up: Changed 2 weeks ago by dmisev

Let's say I specify WCPS query

for c in (coverageName) return encode((c-2)/(c+2), "GTiff")

Do you see the problem that this is very hard to use in WMS?

WMS has its own encoding format first of all so the encode here will need to be ignored, and second, the query needs to be applied to each tile separately.

comment:10 in reply to: ↑ 9 Changed 2 weeks ago by bphamhuu

Replying to dmisev:

Let's say I specify WCPS query

for c in (coverageName) return encode((c-2)/(c+2), "GTiff")

Do you see the problem that this is very hard to use in WMS?

WMS has its own encoding format first of all so the encode here will need to be ignored, and second, the query needs to be applied to each tile separately.

When a GetMap? request with format=image/png then the WCPS query internally (does not matter what kind of encoding the result should use the requested format). So each request is one tile and they use the same encoding.

comment:11 follow-up: Changed 2 weeks ago by dmisev

I'm not sure what you just said as some words are missing..

When a GetMap request with format=image/png then the WCPS query internally ...

internally what?

comment:12 in reply to: ↑ 11 Changed 2 weeks ago by bphamhuu

Replying to dmisev:

I'm not sure what you just said as some words are missing..

When a GetMap request with format=image/png then the WCPS query internally ...

internally what?

it should internally replace the encoding format with the requested format (Gtiff -> png).

comment:13 follow-up: Changed 2 weeks ago by dmisev

So you already need to fiddle with the query string in some non-robust way probably. What happens with (c-2)/(c+2) then, how is it translated to each tile? You need to isolate the c's somehow and apply the tile subsets to them. This is why we have the $Iterator notation in rasqlQueryFragment as far as I understand.

comment:14 in reply to: ↑ 13 Changed 2 weeks ago by bphamhuu

Replying to dmisev:

So you already need to fiddle with the query string in some non-robust way probably. What happens with (c-2)/(c+2) then, how is it translated to each tile? You need to isolate the c's somehow and apply the tile subsets to them. This is why we have the $Iterator notation in rasqlQueryFragment as far as I understand.

it can be whatever WCPS query and (c-2)*c*c*c*......................*c (with c is 2D and GetMap? format is png then the output is 2D png), in WMS a layer is equivalent to a coverage and a rasdaman collection and a style is just what you want to query on the layer.

No need to make up a weird syntax for this.

comment:15 follow-up: Changed 2 weeks ago by dmisev

Ok no problem if you say it works so easily.

comment:16 in reply to: ↑ 15 Changed 2 weeks ago by bphamhuu

Replying to dmisev:

Ok no problem if you say it works so easily.

I did not say it is easy, it will have some constraints as this combination between a WMS request and WCPS is not the land for creative (e.g: GetMap? with one layer but WCPS goes to another non-existing layer), but the most important target of this ticket is to let user uses WMS better when supporting them the familiar syntax of WCPS and that is what I will try.

comment:17 follow-up: Changed 2 weeks ago by dmisev

Exactly those parts that you want to preserve could lead to user errors:

  • for c in (cov_name): WMS already knows the coverage name very well
  • encode(coverageExpr, "format"): WMS already knows exactly what format to convert, what's the point in me specifying tiff or netcdf if it is simply ignored? It's confusing.

Only the coverageExpr should be allowed in my opinion, the rest doesn't make any sense in this context and is totaly useless.

comment:18 in reply to: ↑ 17 Changed 2 weeks ago by bphamhuu

Replying to dmisev:

Exactly those parts that you want to preserve could lead to user errors:

  • for c in (cov_name): WMS already knows the coverage name very well
  • encode(coverageExpr, "format"): WMS already knows exactly what format to convert, what's the point in me specifying tiff or netcdf if it is simply ignored? It's confusing.

Only the coverageExpr should be allowed in my opinion, the rest doesn't make any sense in this context and is totaly useless.

yes, I agree with your statement, it can be called wcpsQueryFragment and it is still WCPS query underneath :).

Note: See TracTickets for help on using tickets.