[gdal-dev] Working with NED elevation data - part 2

Chaitanya kumar CH chaitanya.ch at gmail.com
Sat Aug 21 23:11:21 EDT 2010


Stephen,

Refer to http://www.gdal.org/gdal_tutorial.html for help in opening the vrt
dataset using gdal.
Use the transformation coefficients from GDALGetGeoTransform() to translate
between lat/long and line/pixel.

http://www.gdal.org/classGDALDataset.html

On Sun, Aug 22, 2010 at 3:37 AM, Stephen Woodbridge <woodbri at swoodbridge.com
> wrote:

> So I have been able to download the NED data and I have US coverage.
> The data is in GeoTiff and all in a single band Int16 format.
> I have create a ned.vrt file.
>
> So I'm interested in writing a simple program in C that I can pass a lat,
> lon and get the elevation. I assume I need to open the .vrt file but looking
> at the GDAL API, I'm not sure how to map the lat, lon to a pixel and then
> how to fetch the pixel value. If it matter, I will probably extend this
> later to process a list of locations or maybe extend it to read a shapefile
> and process the shape through it.
>
> Does anyone have a sample program that does something like this.
>
> -Steve
>
>
>
> woodbri at mappy:/u/srcdata$ gdalinfo -stats ned2.vrt
> Driver: VRT/Virtual Raster
> Files: ned2.vrt
>       NED2/-100_25_-96_28.tif
>       NED2/-102_28_-96_30.tif
>       NED2/-102_30_-96_32.tif
>       NED2/-102_32_-96_34.tif
>       NED2/-102_34_-96_36.tif
>       NED2/-102_36_-96_38.tif
>       NED2/-102_38_-96_40.tif
>       NED2/-102_40_-96_42.tif
>       NED2/-102_42_-96_44.tif
>       NED2/-102_44_-96_46.tif
>       NED2/-102_46_-96_48.tif
>       NED2/-102_48_-96_50.tif
>       NED2/-108_28_-102_30.tif
>       NED2/-108_30_-102_32.tif
>       NED2/-108_32_-102_34.tif
>       NED2/-108_34_-102_36.tif
>       NED2/-108_36_-102_38.tif
>       NED2/-108_38_-102_40.tif
>       NED2/-108_40_-102_42.tif
>       NED2/-108_42_-102_44.tif
>       NED2/-108_44_-102_46.tif
>       NED2/-108_46_-102_48.tif
>       NED2/-108_48_-102_50.tif
>       NED2/-114_30_-108_32.tif
>       NED2/-114_32_-108_34.tif
>       NED2/-114_34_-108_36.tif
>       NED2/-114_36_-108_38.tif
>       NED2/-114_38_-108_40.tif
>       NED2/-114_40_-108_42.tif
>       NED2/-114_42_-108_44.tif
>       NED2/-114_44_-108_46.tif
>       NED2/-114_46_-108_48.tif
>       NED2/-114_48_-108_50.tif
>       NED2/-120_32_-114_34.tif
>       NED2/-120_34_-114_36.tif
>       NED2/-120_36_-114_38.tif
>       NED2/-120_38_-114_40.tif
>       NED2/-120_40_-114_42.tif
>       NED2/-120_42_-114_44.tif
>       NED2/-120_44_-114_46.tif
>       NED2/-120_46_-114_48.tif
>       NED2/-120_48_-114_50.tif
>       NED2/-123_33_-120_37.tif
>       NED2/-125_37_-120_39.tif
>       NED2/-125_39_-120_42.tif
>       NED2/-126_42_-120_44.tif
>       NED2/-126_44_-120_46.tif
>       NED2/-126_46_-120_48.tif
>       NED2/-126_48_-120_50.tif
>       NED2/133_6.5_138.5_10.tif
>       NED2/-139.0019842_51.9997277_-127.0018384_58.9998127.tif
>       NED2/-139.0024054_58.9997472_-127.0018101_66.0000944.tif
>       NED2/144_13_146_16.tif
>       NED2/151_5_163.5_8.tif
>       NED2/-157_18_-152_23.tif
>       NED2/-157.5_18.75_-154.5_21.5.tif
>       NED2/-160.5_21_-157.5_22.5.tif
>       NED2/-162_18_-157_23.tif
>       NED2/-171_-14.5_-169_-14.tif
>       NED2/-68_17_-64_18.tif
>       NED2/-72.0002778_40.9999994_-67.9999992_44.tif
>       NED2/-72.0002778_44_-66_46.tif
>       NED2/-72.0002778_46_-66_48.tif
>       NED2/-78.0002778_33.0000047_-75.0000047_36.tif
>       NED2/-78.0002778_36_-72_38.tif
>       NED2/-78.0002778_38_-72_40.tif
>       NED2/-78.0002778_40_-72_42.tif
>       NED2/-78.0002778_42_-72_44.tif
>       NED2/-78.0002778_44_-72_46.tif
>       NED2/-84.0002778_24_-78_26.tif
>       NED2/-84.0002778_26_-78_28.tif
>       NED2/-84.0002778_28_-78_30.tif
>       NED2/-84.0002778_30_-78_32.tif
>       NED2/-84.0002778_32_-78_34.tif
>       NED2/-84.0002778_34_-78_36.tif
>       NED2/-84.0002778_36_-78_38.tif
>       NED2/-84.0002778_38_-78_40.tif
>       NED2/-84.0002778_40_-78_42.tif
>       NED2/-84.0002778_42_-78_44.tif
>       NED2/-85.0002778_44.0000047_-82.0000047_47.tif
>       NED2/-90_28_-84_30.tif
>       NED2/-90_30_-84_32.tif
>       NED2/-90_32_-84_34.tif
>       NED2/-90_34_-84_36.tif
>       NED2/-90_36_-84_38.tif
>       NED2/-90_38_-84_40.tif
>       NED2/-90_40_-84_42.tif
>       NED2/-90_42_-84_44.tif
>       NED2/-90_44_-85_46.tif
>       NED2/-90_46_-85_49.tif
>       NED2/-96_28_-90_30.tif
>       NED2/-96_30_-90_32.tif
>       NED2/-96_32_-90_34.tif
>       NED2/-96_34_-90_36.tif
>       NED2/-96_36_-90_38.tif
>       NED2/-96_38_-90_40.tif
>       NED2/-96_40_-90_42.tif
>       NED2/-96_42_-90_44.tif
>       NED2/-96_44_-90_46.tif
>       NED2/-96_46_-90_48.tif
>       NED2/-96_48_-90_50.tif
> Size is 1180816, 284173
> Coordinate System is:
> GEOGCS["WGS 84",
>    DATUM["WGS_1984",
>        SPHEROID["WGS 84",6378137,298.257223563,
>            AUTHORITY["EPSG","7030"]],
>        AUTHORITY["EPSG","6326"]],
>    PRIMEM["Greenwich",0],
>    UNIT["degree",0.0174532925199433],
>    AUTHORITY["EPSG","4326"]]
> Origin = (-171.000000000113090,66.000094447240443)
> Pixel Size = (0.000283278659440,-0.000283278659440)
> Corner Coordinates:
> Upper Left  (-171.0000000,  66.0000944) (171d 0'0.00"W, 66d 0'0.34"N)
> Lower Left  (-171.0000000, -14.5000520) (171d 0'0.00"W, 14d30'0.19"S)
> Upper Right ( 163.4999735,  66.0000944) (163d29'59.90"E, 66d 0'0.34"N)
> Lower Right ( 163.4999735, -14.5000520) (163d29'59.90"E, 14d30'0.19"S)
> Center      (  -3.7500132,  25.7500212) (  3d45'0.05"W, 25d45'0.08"N)
> Band 1 Block=128x128 Type=Int16, ColorInterp=Gray
>  Minimum=-83.000, Maximum=4665.000, Mean=25.333, StdDev=189.129
>  Metadata:
>    STATISTICS_MINIMUM=-83
>    STATISTICS_MAXIMUM=4665
>    STATISTICS_MEAN=25.332848474484
>    STATISTICS_STDDEV=189.12886049417
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>



-- 
Best regards,
Chaitanya kumar CH.
/tʃaɪθənjə/ /kʊmɑr/
+91-9494447584
17.2416N 80.1426E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100822/b3ce3f29/attachment.html


More information about the gdal-dev mailing list