Ciao Oleg,
please red below...

On Tue, Sep 9, 2008 at 10:40 AM, Oleg72 <[EMAIL PROTECTED]> wrote:

>
> Dear All,
> I am trying to obtain a minimum value from an ASCII Grid. Unfortunately I
> am
> getting a nodata value instead.
> I tried 2 ways:
> - category.get(1).getRange().getMinimum(), and
> - gridcoverage.getProperty("minimum") (based on Extrema operation)
> both methods return -9999.0 (which is nodata value) but the real min value
> is about 700



First observation. As noted before the category mechanism will not give you
the min value.
The best way to solve your problem would be as follow:

1> Get the NODATA value  (check for the nodata category)
2a> if NODATA is NAN (as in grass ascii grids) extrema should give you the
min
2b> if NODATA is not NAN ( as in esri ascii grids) histogram would be you
friend as long as the NODATA is outside the valid range of your data. You
can use histogram to get statistics only a specifi range of you dynamic.
Of course I am open to suggestions for improving the usability of the
arcgrid plugin.

Hope that helps.
Ciao,
Simone.



>
>
> The complete code I used:
>
> File file = new File("raster.asc");
> ArcGridReader reader = new ArcGridReader(file);
> gc = (GridCoverage2D) reader.read(null);
> System.out.println("min VALUE: "
> +gc.getSampleDimension(0).getCategories().get(1).getRange().getMinimum());
>
> op= new OperationJAI("Extrema");
> ParameterValueGroup params = op.getParameters();
> params.parameter("Source").setValue(gc);
> gc=(GridCoverage2D)op.doOperation(params,null);
> System.out.println("Grid Minimum
> "+((double[])gc.getProperty("minimum"))[0]);
>
> Thank you very much in advance,
> Oleg
>
> --
> View this message in context:
> http://www.nabble.com/ASCII-Grid-min-value-tp19388244p19388244.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Geotools-gt2-users mailing list
> Geotools-gt2-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>



-- 
-------------------------------------------------------
Eng. Simone Giannecchini
GeoSolutions S.A.S.
Owner - Software Engineer
Via Carignoni 51
55041 Camaiore (LU)
Italy

phone: +39 0584983027
fax: +39 0584983027
mob: +39 333 8128928


http://www.geo-solutions.it
http://www.geo-solutions.it/simone.giannecchini

-------------------------------------------------------
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to