Opened 7 years ago

Closed 7 years ago

#1490 closed feature (fixed)

Support wcpsTransformQuery in WMS InsertStyle requests

Reported by: Dimitar Misev Owned by: Bang Pham Huu
Priority: major Milestone: 9.5
Component: petascope Version: development
Keywords: Cc: Vlad Merticariu, Bang Pham Huu
Complexity: Medium

Description (last modified by Dimitar Misev)

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 (19)

comment:1 by Dimitar Misev, 7 years ago

Cc: Bang Pham Huu added
Description: modified (diff)
Owner: changed from Bang Pham Huu to Dimitar Misev
Status: newassigned
Summary: Generate rasqlStyleFragment for WMS from WCPS queryGenerate rasqlTransformFragment for WMS from WCPS query

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

comment:2 by Dimitar Misev, 7 years ago

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 by Bang Pham Huu, 7 years ago

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

comment:4 by Dimitar Misev, 7 years ago

Description: modified (diff)
Milestone: 9.49.5
Summary: Generate rasqlTransformFragment for WMS from WCPS querySupport wcpsTransformQuery in WMS InsertStyle requests
Type: defectfeature

comment:5 by Bang Pham Huu, 7 years ago

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 by Bang Pham Huu, 7 years ago

Owner: changed from Dimitar Misev to Bang Pham Huu

comment:7 by Dimitar Misev, 7 years ago

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.

in reply to:  7 comment:8 by Bang Pham Huu, 7 years ago

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 by Dimitar Misev, 7 years ago

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.

in reply to:  9 comment:10 by Bang Pham Huu, 7 years ago

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 by Dimitar Misev, 7 years ago

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?

in reply to:  11 comment:12 by Bang Pham Huu, 7 years ago

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 by Dimitar Misev, 7 years ago

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.

in reply to:  13 comment:14 by Bang Pham Huu, 7 years ago

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 by Dimitar Misev, 7 years ago

Ok no problem if you say it works so easily.

in reply to:  15 comment:16 by Bang Pham Huu, 7 years ago

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 by Dimitar Misev, 7 years ago

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.

in reply to:  17 comment:18 by Bang Pham Huu, 7 years ago

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 :).

comment:19 by Bang Pham Huu, 7 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.