Opened 9 years ago
Closed 9 years ago
#1018 closed defect (duplicate)
Wrong subset Y with mages without georeferenced
Reported by: | Bang Pham Huu | Owned by: | Bang Pham Huu |
---|---|---|---|
Priority: | major | Milestone: | 9.2 |
Component: | petascope | Version: | |
Keywords: | Cc: | Dimitar Misev, Alex Dumitru, Vlad Merticariu | |
Complexity: | Medium |
Description
I could ingest georeferenced TIFF file with latitude and longtitude but could not ingest iungeoreferenced PNG like rgb, mr,… because
http://localhost:8080/rasdaman/ows?service=WCS&version=2.0.1&request=UpdateCoverage&coverageId=ad09&subset1=i(0.0,400.0)&inputCoverageRef=file:///tmp/90008feb_64a4_43b9_b486_bd92a90be50b.gml&subset2=j(344.0,0.0)
in the subset2 it shows a wrong values, it should be miny, maxy: j(0, 344). I've investigated in wcst_import/util/gdal_util.py and see your formula to calculate min, max of X and min, max of Y.
See your code first
# My comment for better understanding GDAL Geotransform: + 0: top left x + 1: west-east pixel resolution (x axis) + 2: 0 value + 3: top left y + 4: 0 value + 4: north-south pixel resolution (y axis) geo_transform = self.gdal_dataset.GetGeoTransform() minx = geo_transform[0] maxy = geo_transform[3] maxx = minx + geo_transform[1] * self.gdal_dataset.RasterXSize miny = maxy + geo_transform[5] * self.gdal_dataset.RasterYSize
It is right with the case when the anchor of axis is in the center (0, 0) because with minx=geo_transform[0] (top left X), maxy = geo_transform[3] (top left Y) and from this point you can canculate maxx and minyy below (low right).
*minx, maxy
*maxx, miny
←————-(0,0)————————→
But with ungeoreferenced image (the anchor point is in the top left) then minx = maxy = 0.0 (it is not TRUE).
- minx, *maxy (0,0)————→ x
|
|
|
|
V y
so that is why I has problem with import RGB images to Petascope because "j" subset is wrong order (max first and min after, like 344.0, 0.0).
I could fix this problem.
Change History (3)
comment:1 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 9 years ago
yes, I've fixed it Dimitar, thanks, I will submit patch now
# BangPH check what kind of images is imported (Geo-Referenced or UnGeo-Referenced first) geo_transform = self.gdal_dataset.GetGeoTransform() if geo_transform[0] == geo_transform[2] == 0: # UnGeo-Referenced image minx = 0 miny = 0 maxx = geo_transform[1] * self.gdal_dataset.RasterXSize # Calculate the maxx = resolution * MaxWidth maxy = geo_transform[5] * self.gdal_dataset.RasterYSize # Calculate the maxy= resolution * MaxHeight else: # Geo-Referenced image minx = geo_transform[0] maxy = geo_transform[3] maxx = minx + geo_transform[1] * self.gdal_dataset.RasterXSize miny = maxy + geo_transform[5] * self.gdal_dataset.RasterYSize return { "x": (minx, maxx), "y": (miny, maxy) }
comment:3 by , 9 years ago
Resolution: | → duplicate |
---|---|
Status: | assigned → closed |
This is a duplicate of ticket #1021
Great that you found the bug Bang, best if you just fix it right away.