Yep, GridGeometry does the trick!
The following code goes with that previous code I adopted from Michael
(above) and noticed it is very slow when I try to return values for each
pixel in the 3601x3601 AsterDEM. The fact that this same GeoTiff can be
rendered and displayed in a couple of seconds in examples like ImageLab.java
on GeoTools tells me that my code is inefficient.
Does anyone have suggestions on streamlining the code so that it doesn't
take ~47 minutes for decoding the entire DEM...? (The AsterDEM contains 3601
x 3601 pixels...)
====================================
Conversion Code:
----------------------------------------------
System.out.println("Start: " + DateTime());
for (int i=gridBounds.getLow(0); i<gridBounds.getHigh(0) + 1; i++) {
for (int j=gridBounds.getLow(1); j<gridBounds.getHigh(1) + 1;
j++) {
dp = cov.getGridGeometry().gridToWorld(new
GridCoordinates2D(i, j));
cov.evaluate(dp, values);
lon = dp.getCoordinate()[0];
lat = dp.getCoordinate()[1];
double ht = values[0];
if (i == 100 && j == 0) System.out.println("line 100: " +
DateTime());
if (i == 500 && j == 0) System.out.println("line 500: " +
DateTime());
if (i == 1000 && j == 0) System.out.println("line 1000: " +
DateTime());
}
}
System.out.println("Finish: " + DateTime());
==================================================
Run Output:
----------------------------------------------------------------
Building tutorial 0.0.1-SNAPSHOT
------------------------------------------------------------------------
[resources:resources]
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory C:\Pieter\Development\GeoTools
AsterDEM\AsterDEM\src\main\resources
[compiler:compile]
Nothing to compile - all classes are up to date
[exec:exec]
grid bounds: GeneralGridEnvelope[0..3600, 0..3600]
world bounds: Envelope2D[(20.999861111111112, -11.00013888888889),
(22.000138888888888, -9.99986111111111)]
num bands: 1
value at DirectPosition2D[21.5, -10.5] is 1105.0
Start: 22-06-2011 10:59:24
line 100: 22-06-2011 11:00:44
line 500: 22-06-2011 11:05:56
line 1000: 22-06-2011 11:12:26
============================================================
--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/Reading-ASTER-DEM-Data-tp3728702p6503540.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users