<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello<br>
<div class="moz-forward-container">
<style data-externalstyle="true"><!--
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
}
p.MsoNormal, li.MsoNormal, div.MsoNormal {
margin:0in;
margin-bottom:.0001pt;
}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst,
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle,
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
line-height:115%;Hello,</style>
<div data-externalstyle="false" dir="ltr" style="font-family:
'Calibri', 'Segoe UI', 'Meiryo', 'Microsoft YaHei UI',
'Microsoft JhengHei UI', 'Malgun Gothic',
'sans-serif';font-size:12pt;">
<div dir="ltr">
<div dir="ltr">
<div>I’m writing this message, because of bug i found in
posgis raster. </div>
<div>(I was unable to create user id on osgeo trac, and as
result to create ticket)</div>
<div><br>
</div>
<div>The bug occurs in ST_AddBand function for out-db
raster.</div>
<div>I used this function in fallowing way:</div>
<div><br>
</div>
<div>select
ST_AddBand(null,'D:\\Mapy\\hrpt_test_12_01_2015.tif',ARRAY[1,
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]);</div>
<div><br>
</div>
<div>And I received such error:</div>
<div>rt_raster_add_band: Can't add a 1200x1200 band to a
1200x1600 raster</div>
<div><br>
</div>
<div>Where hrpt_test_12_01_2015.tif is 1200px x 1600px valid
GeoTiff with 14 bands, and it gdalinfo is as fallows:</div>
<div>Driver: GTiff/GeoTIFF<br>
Files: hrpt_test_12_01_2015.tif<br>
Size is 1200, 1600<br>
Coordinate System is:<br>
PROJCS["Mercator, WGS 84, Bands: Solar zenith°,Solar
azimuth°,Nadir to pixel°,Satellite inclination°,AVHRR
channel 1 - raw,AVHRR channel 1 - albedo%,AVHRR channel 2
- raw,AVHRR channel 2 - albedo%,AVHRR channel 3 -
raw,AVHRR channel 3 - temperature°C,AVHRR channel 4 -
raw,AVHRR channel 4 - temperature°C,AVHRR channel 5 -
raw,AVHRR channel 5 - temperature°C",<br>
GEOGCS["Unknown datum based upon the WGS 84
ellipsoid",<br>
DATUM["Not_specified_based_on_WGS_84_ellipsoid",<br>
SPHEROID["WGS 84",6378137,298.257223563,<br>
AUTHORITY["EPSG","7030"]],<br>
AUTHORITY["EPSG","6030"]],<br>
PRIMEM["Greenwich",0],<br>
UNIT["degree",0.0174532925199433],<br>
AUTHORITY["EPSG","4030"]],<br>
PROJECTION["Mercator_1SP"],<br>
PARAMETER["central_meridian",0],<br>
PARAMETER["scale_factor",1],<br>
PARAMETER["false_easting",0],<br>
PARAMETER["false_northing",0],<br>
UNIT["unknown",1]]<br>
Origin = (1500000.000000000500000,7799999.999998852600000)<br>
Pixel Size = (1000.000000000000000,-1000.000000000000000)<br>
Metadata:<br>
AREA_OR_POINT=Area<br>
TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)<br>
TIFFTAG_XRESOLUTION=96<br>
TIFFTAG_YRESOLUTION=96<br>
Image Structure Metadata:<br>
INTERLEAVE=BAND<br>
Corner Coordinates:<br>
Upper Left ( 1500000.000, 7800000.000) ( 13d28'29.03"E,
57d22'10.14"N)<br>
Lower Left ( 1500000.000, 6200000.000) ( 13d28'29.03"E,
48d44'51.33"N)<br>
Upper Right ( 2700000.000, 7800000.000) ( 24d15'16.25"E,
57d22'10.14"N)<br>
Lower Right ( 2700000.000, 6200000.000) ( 24d15'16.25"E,
48d44'51.33"N)<br>
Center ( 2100000.000, 7000000.000) ( 18d51'52.64"E,
53d16'34.72"N)<br>
Band 1 Block=1200x1 Type=Float32, ColorInterp=Gray<br>
Band 2 Block=1200x1 Type=Float32, ColorInterp=Undefined<br>
Band 3 Block=1200x1 Type=Float32, ColorInterp=Undefined<br>
Band 4 Block=1200x1 Type=Float32, ColorInterp=Undefined<br>
Band 5 Block=1200x1 Type=Float32, ColorInterp=Undefined<br>
Band 6 Block=1200x1 Type=Float32, ColorInterp=Undefined<br>
Band 7 Block=1200x1 Type=Float32, ColorInterp=Undefined<br>
Band 8 Block=1200x1 Type=Float32, ColorInterp=Undefined<br>
Band 9 Block=1200x1 Type=Float32, ColorInterp=Undefined<br>
Band 10 Block=1200x1 Type=Float32, ColorInterp=Undefined<br>
Band 11 Block=1200x1 Type=Float32, ColorInterp=Undefined<br>
Band 12 Block=1200x1 Type=Float32, ColorInterp=Undefined<br>
Band 13 Block=1200x1 Type=Float32, ColorInterp=Undefined<br>
Band 14 Block=1200x1 Type=Float32, ColorInterp=Undefined<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>As you can see bug occurs for non square rasters.</div>
<div><br>
</div>
<div>I tired to track this bug in source code, and I found
somethig. It is located in rtpg_create.c file in <span
class="nf">RASTER_addBandOutDB() function,</span> line
776.<br>
</div>
<div data-signatureblock="true"><a moz-do-not-send="true"
href="http://trac.osgeo.org/postgis/browser/trunk/raster/rt_pg/rtpg_create.c#L776"
target="_parent">http://trac.osgeo.org/postgis/browser/trunk/raster/rt_pg/rtpg_create.c#L776</a></div>
<div>Width of raster is written to height variable, which
causes problem.</div>
<div><br>
</div>
<div>I hope this will be helpful.</div>
<div><br>
</div>
<div>I’m using postgis:</div>
<div>“POSTGIS="2.1.5 r13152" GEOS="3.4.2-CAPI-1.8.2 r3924"
PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.11.1,
released 2014/09/24" LIBXML="2.7.8" LIBJSON="UNKNOWN"
RASTER”,</div>
<div>and postgres:</div>
<div>"PostgreSQL 9.4.0, compiled by Visual C++ build 1800,
64-bit"</div>
<div><br>
</div>
<div>Best Regards</div>
<div>Tomasz Bieliński</div>
<div>Gdańsk University of Technology<br>
</div>
</div>
</div>
</div>
<br>
</div>
<br>
</body>
</html>