[gdal-dev] GDAL - JAVA getting Elevation Data
Michael Smith
michael.smith.erdc at gmail.com
Wed Feb 1 02:10:20 PST 2017
Use gdalbuildvrt to merge all your rasters to a single virtual file and the open that vrt.
Michael Smith
Remote Sensing/GIS Center
US Army Corps of Engineers
> On Feb 1, 2017, at 4:02 AM, Mahir Karabacak <mkarabacak at meteksan.com> wrote:
>
> Hi All,
>
> I hava Java code below which gets elevation data according to coordinate. My question; what if I have multiple GeoTiff files, how can I read all into one dataset or merge all data into one dataset?
>
> Thanks in Advance,
> Mahir KARABACAK
>
>
> private static Dataset elevationDataSet;
> private static double[] geoTransformsInDoubles;
> private static Band rasterBand;
> private static double[] invGeoTransformsInDoubles;
>
>
> elevationDataSet = gdal.Open("M:/maps/20170130011154_1642612357.tif", gdalconst.GA_ReadOnly);
> geoTransformsInDoubles = elevationDataSet.GetGeoTransform();
> rasterBand = elevationDataSet.GetRasterBand(1);
> invGeoTransformsInDoubles = gdal.InvGeoTransform(geoTransformsInDoubles);
>
> double[] pdfGeoX = new double [1];
> double[] pdfGeoY = new double [1];
>
> gdal.ApplyGeoTransform(invGeoTransformsInDoubles, lon, lat, pdfGeoX, pdfGeoY);
> double [] flt = new double[2];
>
> int readResult = rasterBand.ReadRaster((int)pdfGeoX[0], (int)pdfGeoY[0], 1,1, gdalconst.GDT_CFloat64,flt);
>
> if (readResult == 0)
> {
> return flt[0];
> }
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
More information about the gdal-dev
mailing list