[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: R: R: [udig-devel] Udig 1.1.1 problems to read sample value in geotiff 16 bit
|
Hi I think you want to take this into the Geotools-users list uDig is
mainly a front end on geotools. In this case i don't know that we
have the expertise you require.
Jesse
On 10-Feb-09, at 4:42 PM, Pasquale Paola wrote:
Do you know how can i set the data_type in a geotiff?
Ciao
Pa
-----Messaggio originale-----
Da: udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx
[mailto:udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx] Per conto di andrea
antonello
Inviato: martedì 10 febbraio 2009 15.53
A: User-friendly Desktop Internet GIS
Oggetto: Re: R: [udig-devel] Udig 1.1.1 problems to read sample
value in
geotiff 16 bit
Hi Pasquale,
I don't have lots of time right now, but very quickly:
- in your getSample method did you check if the called method enters
the
right type?
- did you check whether the geoRes you get as Gridcoverage2d is of
type
rendered (for visualization) or geophisical view? I assume you will
need the
geophisical one.
Does this help you a bit further?
Ciao
Andrea
On Tue, Feb 10, 2009 at 3:42 PM, Pasquale Paola
<pasquale.paola@xxxxxx>
wrote:
This is my core code:
ILayer layer = geoOpt.getLayer();
GridCoverage2D geoRes = null;
/*
* List<IGeoResource> bobobo =
layer.getGeoResources(); for
* (IGeoResource item : bobobo) {
GridCoverage geo =
* item.resolve(GridCoverage.class, new
NullProgressMonitor());
* geoRes = (GridCoverage2D) geo;
item.getInfo(new
* NullProgressMonitor());
*
* if (geoRes != null) break; }
*/
geoRes = (GridCoverage2D)
layer.getGeoResource().resolve(
GridCoverage.class, new
NullProgressMonitor());
Raster raster =
geoRes.getRenderedImage().getData();
String sample =
getSample(raster.getSample(i, j, z), dataSampleType);
----------------------------------------------------------------------
------
------------------------------------------------
/*******/
private static String getSample(Object sample, int type)
{
String result = "";
try
{
switch (type)
{
case
java.awt.image.DataBuffer.TYPE_BYTE:
result = ((Byte)
sample).toString();
break;
case
java.awt.image.DataBuffer.TYPE_DOUBLE:
result = ((Double)
sample).toString();
break;
case
java.awt.image.DataBuffer.TYPE_FLOAT:
result = ((Float)
sample).toString();
break;
case
java.awt.image.DataBuffer.TYPE_INT:
result = ((Integer)
sample).toString();
break;
case
java.awt.image.DataBuffer.TYPE_SHORT:
result = ((Short)
sample).toString();
break;
case
java.awt.image.DataBuffer.TYPE_UNDEFINED:
result = sample.toString();
break;
case
java.awt.image.DataBuffer.TYPE_USHORT:
result = ((Short)
sample).toString();
break;
default:
break;
}
} catch (ClassCastException e)
{
result = ((Integer) sample).toString();
}
return result;
}
Ciao
Pasquale
-----Messaggio originale-----
Da: udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx
[mailto:udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx] Per conto di andrea
antonello
Inviato: martedì 10 febbraio 2009 15.29
A: User-friendly Desktop Internet GIS
Oggetto: Re: [udig-devel] Udig 1.1.1 problems to read sample value in
geotiff 16 bit
I'm developing a plugin for udig(1.1.1 win32) and when I try to read
the sample value of pixel in a geotiff with 16 bit of depth, I
obtain always the same value 2147483647 (that is 2^31). Some ideas?
Can i read sample value of geotiff with 16 bit of depth?
How exactly are you reading the image to get your information?
Not sure how raster were dealth with in udig 1.1, but you should be
able to access the imagereader and get your values.
Do you have some code so show us?
Ciao
Andrea
Cheers
--
View this message in context:
http://www.nabble.com/Udig-1.1.1-problems-to-read-sample-value-in-
geo
t
iff-16-bit-tp21934226p21934226.html
Sent from the udig-devel mailing list archive at Nabble.com.
_______________________________________________
User-friendly Desktop Internet GIS (uDig) http://
udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
_______________________________________________
User-friendly Desktop Internet GIS (uDig) http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
_______________________________________________
User-friendly Desktop Internet GIS (uDig) http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
_______________________________________________
User-friendly Desktop Internet GIS (uDig) http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel