Opened 7 years ago

Closed 6 years ago

#1744 closed defect (fixed)

Petascope_Support map mosaic with overlapping tiles

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

Description

Current, with map mosaic 2D from WCST_Import, Petascope can only work if tiles are not overlapping. However, if one of tile overlaps imported tiles, it will throw exception because the number of calculated grid pixels is not as same as from the adding tile to coverage.

Example:

Progress: [#################-------------] 145/251 57.77%
Failed to insert slice. Attempted 1 times.
Service Call: http://localhost:8080/rasdaman/ows?service=WCS&version=2.0.1&request=UpdateCoverage&coverageId=DTM&subset=E(449790.0,500210.0)&inputCoverageRef=file:///tmp/f981917f_94e7_4ba9_a118_5696e1de497c.gml&subset=N(7349785.0,7400215.0)
Error Code: 404
Error Text: Failed reading response from WCS service. Detailed error: Runtime error: Failed opening connection to 'http://localhost:8080/rasdaman/ows?service=WCS&version=2.0.1&request=UpdateCoverage&coverageId=DTM&subset=E(449790.0,500210.0)&inputCoverageRef=file:///tmp/f981917f_94e7_4ba9_a118_5696e1de497c.gml&subset=N(7349785.0,7400215.0)'. Check that the service is up and running.Detail error: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ows:ExceptionReport version="2.0.1"
    xsi:schemaLocation="http://www.opengis.net/ows/2.0 http://schemas.opengis.net/ows/2.0/owsExceptionReport.xsd"
    xmlns:ows="http://www.opengis.net/ows/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
    <ows:Exception exceptionCode="InvalidExtent">
        <ows:ExceptionText>The grid domain of the update input coverage ([0:5041,0:5042]) is incompatible with the computed grid domain in the target coverage ([39999:45041,-90001:-84959]).

HINT: If using wcst_import, please try again using "subset_correction": true (or false with imported coverage with "subset_correction": true) in the ingredient file.</ows:ExceptionText>
    </ows:Exception>
</ows:ExceptionReport>

The problem can be seen from the image in the attachment file.

Attachments (1)

overlapping_mosaic.png (24.2 KB ) - added by Bang Pham Huu 7 years ago.
Illustration for overlapping tiles

Download all attachments as: .zip

Change History (11)

by Bang Pham Huu, 7 years ago

Attachment: overlapping_mosaic.png added

Illustration for overlapping tiles

comment:1 by Dimitar Misev, 7 years ago

Milestone: 9.69.7

comment:2 by Dimitar Misev, 7 years ago

if one of tile overlaps imported tiles, it will throw exception because the number of calculated grid pixels is not as same as from the adding tile to coverage

I'm not sure I understand well what you mean here. Can you try to explain the problem more clearly?

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

Replying to dmisev:

if one of tile overlaps imported tiles, it will throw exception because the number of calculated grid pixels is not as same as from the adding tile to coverage

I'm not sure I understand well what you mean here. Can you try to explain the problem more clearly?

For instance, the updating slice from WCST_Import will have a grid [0:100] domain, but from Petascope, the calculated grid is [90:180] because the lower geo bound of updating slice overlaps with the upper geo bound of current coverage. Then, the validator throws exception because the grid domains [0:100] and [90:180] don't match.

comment:4 by Bang Pham Huu, 7 years ago

Priority: majorcritical

comment:5 by Dimitar Misev, 7 years ago

Shouldn't the calculated grid in petascope be at least [90:190] (i.e. the width is preserved)?

Let's imagine this case:

(0,0)             (100,0)
   +--------------+
   |              |
   | petascope    |
   |              |
   |       (90,90)|                   (300,90)
   |          +----------------------+
   |          |   |                  |
   +--------------+                  |
(0,100)       |     (100,100)        |
              |                      |
              |                      |
              |       update         |
              |                      |
              |                      |
              |                      |
              +----------------------+
            (90,300)                  (300,300)

What exactly happens here?

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

The subsets from WCST_Import will be: [0:210, 0:210] and in Petascope, it uses the domain max with coordinates (100, 100) to calculate grid coordinates. The calculated result is: [100:300, 100:300] and don't match with the input from WCST_Import [0:210, 0:210].

Last edited 7 years ago by Dimitar Misev (previous) (diff)

comment:7 by Dimitar Misev, 7 years ago

Ok but that shouldn't be so hard to do correctly? Aren't you supposed to do the grid coordinates calculation from the origin (0,0)? I'm not sure why it does it from the max.

comment:8 by Bang Pham Huu, 7 years ago

Owner: set to Bang Pham Huu
Status: newassigned

The solution for this ticket (thanks to Vlad) will be solved in this example:

  • Imported coverage with geo domains Long(6.5552400,10.9502400), Lat(53.5309000,55.3709000), resolution: Long(0.005), Lat(-0.005), called: Image1
  • Input slice with geo domains Long(7.0651200,11.3951200), Lat(52.9084000,54.7484000), resolution: Long(0.005), Lat(-0.005), called Image2.

Image1 intersects with Image2 in both Long and Lat axes with:

  • Long_min1 < Long_min2 < Long_max1 < Long_max2
  • Lat_min2 < Lat_min1 < Lat_max1 < Lat_max2

The formula will be:

  • (Long_min_2 - Long_min_1) = (7.0651200 - 6.5552400) / 0.005 = 101.97599999999997
    • Because, the output is float number, then it needs to be shifted by an offset. The offset value will be: (Math.ceil(101.97599999999997) - 101.97599999999997) / 0.005 = 0.00012000000000014665
    • Then, the min_Long_2 will be shifted by this offset: 7.0651200 + 0.00012 = 7.06524
  • (Long_max_2 - Long_max_1) = (11.3951200 - 10.9502400) / 0.005 = 88.9759999999999
    • Because, the output is float number, then it needs to be shifted by an offset. The offset value will be: (Math.ceil(88.9759999999999) - 88.9759999999999) / 0.005 = 0.00012000000000050193
    • Then, the max_Long_2 will be shifted by this offset: 11.3951200 + 0.00012 = 11.39524

The output of gdal_merge for Long domain of these 2 images is: [6.5552400,11.3952400]

comment:9 by Dimitar Misev, 7 years ago

Sounds great. Please make sure to add tests for map_mosaic, the timeseries recipes, and the general coverage one.

comment:10 by Bang Pham Huu, 6 years ago

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