<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=blue>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Hi Daniele-<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>No, I’m not sure that it does. But
here’s the thing that bugs me: when I run my Java code it concludes that<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Min=-128<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Max = 127<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>However, when I run gdalinfo on the file, I
get the following information:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Driver: JPEG/JPEG JFIF<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Size is 2592, 1296<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Band 1 Block=2592x1 Type=Byte,
ColorInterp=Red<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> Computed
Min/Max=0.000,235.000<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Band 2 Block=2592x1 Type=Byte,
ColorInterp=Green<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> Computed
Min/Max=0.000,228.000<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Band 3 Block=2592x1 Type=Byte,
ColorInterp=Blue<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> Computed
Min/Max=0.000,238.000<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>So I thought I might be reading the ByteBuffer
incorrectly.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Thanks,<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Chris<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> Daniele
Romagnoli [mailto:dany.geotools@gmail.com] <br>
<b><span style='font-weight:bold'>Sent:</span></b> Friday, July 28, 2006 1:36
AM<br>
<b><span style='font-weight:bold'>To:</span></b> Christopher Condit<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [Gdal-dev] gdal java
bindings</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>Hi Cris.<br>
<br>
Are you sure that the rasterBand of your sample file contains the Offset and
Scale values?<br>
They are optional properties of a RasterBand. <br>
<br>
I have used your code with my HDF format samples and it works fine. <br>
<br>
Maybe your sample has no information about this.<br>
<br>
regards, Daniele<o:p></o:p></span></font></p>
<div>
<p class=MsoNormal><span class=gmailquote><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>On 7/28/06, <b><span style='font-weight:bold'>Christopher
Condit</span></b> <<a href="mailto:condit@sdsc.edu">condit@sdsc.edu </a>>
wrote:</span></font></span><o:p></o:p></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Does anyone have experience with the GDAL Java bindings? I'm
trying to <br>
use them for raster access and can't seem to get the raw data.<br>
<br>
The key problem seems to me that band.GetOffset, GetScale, and<br>
GetNoDataValue are failing. They all return void in the Double[]. Am I<br>
calling them wrong? getXSize/getYsize works fine. <br>
<br>
Here's the function:<br>
void dump()<br>
{<br>
Band
band = image.GetRasterBand(1);<br>
int
x = band.getXSize();<br>
int
y = band.getYSize();<br>
ByteBuffer
data = ByteBuffer.allocateDirect(x * y);<br>
<br>
band.ReadRaster_Direct(0,
0, x, y, x, y,<br>
band.getDataType(), data);<br>
Double[]
offset = new Double[1], scale = new Double[1],<br>
nodata = new Double[1]; <br>
band.GetOffset(offset);<br>
band.GetScale(scale);<br>
band.GetNoDataValue(nodata);<br>
double
min = 1000;<br>
double
max = -1000;<br>
while
( data.hasRemaining())<br>
{<br>
double
val = (data.get() * scale[0]) +<br>
offset[0];<br>
if
(val < min)<br>
min
= val;<br>
if
(val > max) <br>
max
= val;<br>
}<br>
System.out.println(min
+ " " + max);<br>
}<br>
<br>
Thanks,<br>
<br>
Chris<br>
<br>
_______________________________________________ <br>
Gdal-dev mailing list<br>
<a href="mailto:Gdal-dev@lists.maptools.org">Gdal-dev@lists.maptools.org</a><br>
<a href="http://lists.maptools.org/mailman/listinfo/gdal-dev">http://lists.maptools.org/mailman/listinfo/gdal-dev
</a><o:p></o:p></span></font></p>
</div>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><o:p> </o:p></span></font></p>
</div>
</body>
</html>