Do you know how can i set the data_type in a geotiff? Please read the following messages, or this thread to know my problems. http://www.nabble.com/Udig-1.1.1-problems-to-read-sample-value-in-geotiff-16-bit-to21934226.html#a21934226 http://www.nabble.com/Udig-1.1.1-problems-to-read-sample-value-in-geotiff-16-bit-to21934226.html#a21934226
Cheers Pa -----Messaggio originale----- Da: Jesse Eichar [mailto:[email protected]] Inviato: mercoledì 11 febbraio 2009 9.04 A: [email protected]; User-friendly Desktop Internet GIS Oggetto: 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: [email protected] > [mailto:[email protected]] 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 > <[email protected]> > 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: [email protected] >> [mailto:[email protected]] 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 -- View this message in context: http://n2.nabble.com/How-can-I-set-sample-data_type-in-a-geotiff--tp2307903p2307903.html Sent from the geotools-devel mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
