On 11 January 2013 12:21, Gökçen Güner <[email protected]> wrote:

> Using JAI was not my decision, I couldn't find a JAI-free Geotools
> solution for this as I said in my first post. I'll be glad to hear it.
>
>
> But you didn't use GeoTools for that bit - the fact that JAI is in
GeoTools is irrelevant to your code. Have a look at
http://docs.geotools.org/latest/userguide/library/coverage/grid.html to see
how to handle raster data in GeoTools.

Ian


> 2013/1/11 Ian Turton <[email protected]>
>
>> As far as I can see your problem is that you decided to use JAI directly
>> instead of calculating NDVI using the GeoTools raster classes that would
>> have maintained the location of the data. JAI is an image processing
>> solution and as such throws away all the geography in the data - then
>> GeoTools is unable to import the image because it doesn't know where it is.
>>
>> Ian
>>
>>
>> On 11 January 2013 11:37, Gökçen Güner <[email protected]> wrote:
>>
>>> Thank you so much guys. I didn't have much time at that time so I
>>> switched from Geotools to Grass, I'm not familiar with Python as much as
>>> Java but it has more features on programming side.
>>>
>>> Besides I couldn't use geotools effectively, I think some native
>>> implementation required this image processing thing. It shouldn't be so
>>> hard to subtract an image from another. You just do it pixel by pixel, you
>>> have same geocode in both files, preserve them and write it to the new
>>> file, it is just easy as that. I looked at JAI related posts, 9 of 10
>>> people say 'don't use it'. I looked at Geotools posts or tutorials, they
>>> all use JAI. Geotools must find a way to get rid of JAI in my opinion.
>>>
>>> It is not directly about geotools, it is about Java for sure but any GIS
>>> framework should have a some way to do this. In Grass, they bridged
>>> functionalities of Grass to Python, you import the classes(modules in
>>> Python) and you are good to go. In image processing, C/C++ has more
>>> popularity in comparison with Java but using JNI it can be dealt with I
>>> think. It is not well documented you can say, it's hard do debug or test
>>> you can say but it should be considered as a solution. Coded with JNI,
>>> proposed as a Java class and users will use it.
>>>
>>> As a Java developer and fan(it is fun to code with java), I felt
>>> disappointed when I realized that in Java we don't have so many choices in
>>> GIS. Geotools still seems to be best but considering its competitors I
>>> think more work is needed.
>>>
>>> Thanks for making time to read this.
>>>
>>> 2013/1/10 Rafael Santos <[email protected]>
>>>
>>>> Hi,
>>>> > I need to find NDVI and other vegetation indices and then find changes
>>>> > in time with tif images.
>>>> >
>>>> > I've been using Geotools for this. Took 2 tiff images, then using QGis
>>>> > I changed them to PNG because original ones are huge. Then taking
>>>> > those 2 PNG I created NDVI image using JAI. The problem is that I
>>>> > couldn't show this file with Geotools. You can look at the code here:
>>>> That code creates a TIFF with floating point pixels, which can be
>>>> loaded/viewed with DisplayNBImage since DisplayNBImage internally
>>>> creates a byte-based surrogate version of the floating-point image. If
>>>> your purpose is just to display the image why not create a byte-based
>>>> one?
>>>>
>>>> >
>>>> > In fact, proposing non-Jai way of the same thing would be awesome.
>>>> >
>>>> If you don't mind having a byte image that should be simple. Open both
>>>> images, declare a matrix of the appropriate size of type float,
>>>> calculate the NDVI for each pixel, create a temporary byte image and
>>>> populate it with the values from the matrix, properly normalized. Some
>>>> steps for this are on
>>>>
>>>> http://www.lac.inpe.br/JIPCookbook/1200-create-gl.jsp#imageanddatamanipulationcreatinggraylevelimages
>>>> . Two caveats: I am not sure if plain Java have readers for TIFF images
>>>> (in case your original images are TIFFs) and the original NDVI values
>>>> will be of course gone -- not an issue for visualization/comparison.
>>>>
>>>> hope it helps
>>>>
>>>> Rafael
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
>>>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
>>>> MVPs and experts. ON SALE this month only -- learn more at:
>>>> http://p.sf.net/sfu/learnmore_122712
>>>> _______________________________________________
>>>> GeoTools-GT2-Users mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
>>> much more. Get web development skills now with LearnDevNow -
>>> 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
>>> SALE $99.99 this month only -- learn more at:
>>> http://p.sf.net/sfu/learnmore_122812
>>>
>>> _______________________________________________
>>> GeoTools-GT2-Users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>>
>>>
>>
>>
>> --
>> Ian Turton
>>
>
>


-- 
Ian Turton
------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to