Thanks Ian for link, looking at Operations and this link: http://docs.geotools.org/stable/javadocs/org/geotools/coverage/processing/operation/package-summary.html I've found some way to go. My thoughts on 2nd post still same though. These seems wrappers around JAI functionalities as Javadoc says the same. I think geotools should draw a path away from JAI, you can read about it and see why people are suggesting to avoid using it.
On 11 January 2013 12:21, Gökçen Güner <firstname.lastname@example.org> 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.Ian2013/1/11 Ian Turton <email@example.com>
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.IanOn 11 January 2013 11:37, Gökçen Güner <firstname.lastname@example.org> 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@example.com>
> I need to find NDVI and other vegetation indices and then find changesThat code creates a TIFF with floating point pixels, which can be
> 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:
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?
If you don't mind having a byte image that should be simple. Open both
> In fact, proposing non-Jai way of the same thing would be awesome.
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
. 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
MVPs and experts. ON SALE this month only -- learn more at:
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
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: