[gdal-dev] DTED Elevations with Java and gdal

Even Rouault even.rouault at mines-paris.org
Tue Oct 19 14:03:34 EDT 2010


George,

It's not appropriate to convert from DTED to PNG. See the warning of 
gdal_translate : DTED is signed 16 bits, but PNG can only support unsigned 16 
bits. So if you translate from DTED to PNG you'll lose the negative values 
(and in particular the nodata=-32767). I'm not sure why you want to convert 
your DTED file and not use it directly ? If you really don't want to read the 
DTED, convert to Geotiff instead

To do this with Java, see the Driver.CreateCopy() method :

http://gdal.org/java/org/gdal/gdal/Driver.html#CreateCopy(java.lang.String,
%20org.gdal.gdal.Dataset)

Best regards,

Even

Le mardi 19 octobre 2010 19:33:53, Corrado, George P. a écrit :
> Hello,
> 
> Does anyone have a java example on how to get elevations from a .dt1 file. 
> My ultimate goal would be to take a .dt1, translate it to a png, and then
> feed the png into gdal to get elevations and coordinates.
> 
> I ran the gdal_translate on one of my .dt1 files and came up with this. 
> Note: this is actually DTED2 even though the file ext is dt1.  Not sure
> why that is, maybe because it's really old.
> 
> C:\jdk1.6.0_21\bin>gdal_translate -of PNG --config GDAL_CACHEMAX 30
> C:\DTED2\DTED\E032\N34.DT1 C:\DTED2\DTED\E032\N34.pn g
> Input file size is 3601, 3601
> Warning 6: PNG driver doesn't support data type Int16. Only eight bit
> (Byte) and sixteen bit (UInt16) bands supported. D efaulting to Byte
> 
> 0...10...20...30...40...50...60...70...80...90...100 - done.
> 
> It created a png file along with an xml file.  I had to do this with the
> gdal_translate.exe file, but eventually I would like to use straight Java.
> 
> Thanks,
> George


More information about the gdal-dev mailing list