Opened 6 years ago

Closed 6 years ago

#1692 closed enhancement (fixed)

WCPS polygon clipping with explicit CRS

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

Description

Polygon clipping and linestring are supported in rasql level. In petascope it needs to implement this feature to translate WCS/WCPS requests to correspondent rasql queries.

Example with WCS GetCoverage request:

localhost:8080/rasdaman/ows?service=WCS&version=2.0.1&request=GetCoverage
&coverageId=test_rgb&subset=i(0,200)&subset=j(0,100)&format=image/png
&clip=Polygon((0 10, 20 20, 20 10, 0 10))

which is equivalent to WCPS queries like this

for c in (test_rgb) 
return encode(clip(c[i(0:200), j(0:100)], Polygon((0 10, 20 20, 20 10, 0 10))), "png")

Only support 1 clip operator in WCS/WCPS as discussed and clip should be applied after all trimming/slicing subsets.

When rasql supports other WKT such as: Multipolygons, Multilines (e.g: http://www.postgis.net/docs/ST_GeomFromText.html) open another ticket to do.

Change History (7)

comment:1 by Bang Pham Huu, 6 years ago

There is a real use case to extend the syntax of clip() operator. User has a coverage in EPSG:3857 and the polygon he has in EPSG:4326 (from shapefile or somewhere else), and he wants to clip coverage (2D, ESPG:3857) by this polygon (ESPG:4326).

But it doesn't work because the coordinates in EPSG:4326 is much different from ESPG:3857 with normal WCPS query like this:

clip(c, POLYGON((Lat1 Long1, Lat2 Long2, Lat3 Long3,...)) )

so, if polygon in different CRS (e.g: EPSG:4326) from coverage's CRS (e.g: EPSG:3857), user needs to specify another parameter for CRS which I propose below:

clip(c, POLYGON((Lat1 Long1, Lat2 Long2, Lat3 Long3,...)), "ESPG:4326")

then the coordinates of polygon are translated from EPSG:4326 to EPSG:3857 which could be applied on coverage c.

with WCS, the request parameter clip will be like this

clip=POLYGON((Lat 1 Long 1, Lat2 Long2,...)),"EPSG:4326"

If polygon's CRS is as same as coverage's CRS, user won't need to specify CRS parameter in clip() operator.

comment:2 by Peter Baumann, 6 years ago

Type: defectenhancement

comment:3 by Peter Baumann, 6 years ago

So you propose to add another optional parameter. It would belong to the polygon, though:

clip( c,
      POLYGON((Lat1 Long1, Lat2 Long2, Lat3 Long3,...), "http://www.opengis..../4326" )
    )

And, as shown above, it needs to use a CRS URL. We might additionally support the "EPSG:4326" notation, beyond the standard, as we do already in other cases.

comment:4 by Peter Baumann, 6 years ago

Summary: Petascope_Implement WCS/WCPS polygon clipping extension for polygon, linestringWCPS polygon clipping with explicit CRS

comment:5 by Dimitar Misev, 6 years ago

It would belong to the polygon, though:

I think the syntax you propose is not WKT compliant.

comment:6 by bbell, 6 years ago

Correct; technically, the WKT format for polygons is as follows:

POLYGON((wkt linestring w/ first vertex repeated last), (another one))

If we want to add the EPSG:4326 notation (w/ or w/o url), then I suggest we make it a part of the clip family by making a small modification to @pbaumann's example

clip( c, POLYGON((points for exterior)), EPSG:4326 )

Now, we would additionally need a way to clarify the coordinates for "c" versus the coordinates in "polygon", so perhaps we should originate our support on the WCS level with something like what @bphamhuu proposed.

Last edited 6 years ago by bbell (previous) (diff)

comment:7 by Bang Pham Huu, 6 years ago

Milestone: 9.59.6
Resolution: fixed
Status: newclosed

Now it supports LineString (2D+), Polygon, Multipolygon (2D) with WCS, WCPS.

Note: See TracTickets for help on using tickets.