Stephen,<br><br>Refer to <a href="http://www.gdal.org/gdal_tutorial.html">http://www.gdal.org/gdal_tutorial.html</a> for help in opening the vrt dataset using gdal.<br>Use the transformation coefficients from GDALGetGeoTransform() to translate between lat/long and line/pixel.<br>
<br><a href="http://www.gdal.org/classGDALDataset.html">http://www.gdal.org/classGDALDataset.html</a><br><br><div class="gmail_quote">On Sun, Aug 22, 2010 at 3:37 AM, Stephen Woodbridge <span dir="ltr">&lt;<a href="mailto:woodbri@swoodbridge.com">woodbri@swoodbridge.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">So I have been able to download the NED data and I have US coverage.<br>
The data is in GeoTiff and all in a single band Int16 format.<br>
I have create a ned.vrt file.<br>
<br>
So I&#39;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&#39;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.<br>

<br>
Does anyone have a sample program that does something like this.<br>
<br>
-Steve<br>
<br>
<br>
<br>
woodbri@mappy:/u/srcdata$ gdalinfo -stats ned2.vrt<br>
Driver: VRT/Virtual Raster<br>
Files: ned2.vrt<br>
       NED2/-100_25_-96_28.tif<br>
       NED2/-102_28_-96_30.tif<br>
       NED2/-102_30_-96_32.tif<br>
       NED2/-102_32_-96_34.tif<br>
       NED2/-102_34_-96_36.tif<br>
       NED2/-102_36_-96_38.tif<br>
       NED2/-102_38_-96_40.tif<br>
       NED2/-102_40_-96_42.tif<br>
       NED2/-102_42_-96_44.tif<br>
       NED2/-102_44_-96_46.tif<br>
       NED2/-102_46_-96_48.tif<br>
       NED2/-102_48_-96_50.tif<br>
       NED2/-108_28_-102_30.tif<br>
       NED2/-108_30_-102_32.tif<br>
       NED2/-108_32_-102_34.tif<br>
       NED2/-108_34_-102_36.tif<br>
       NED2/-108_36_-102_38.tif<br>
       NED2/-108_38_-102_40.tif<br>
       NED2/-108_40_-102_42.tif<br>
       NED2/-108_42_-102_44.tif<br>
       NED2/-108_44_-102_46.tif<br>
       NED2/-108_46_-102_48.tif<br>
       NED2/-108_48_-102_50.tif<br>
       NED2/-114_30_-108_32.tif<br>
       NED2/-114_32_-108_34.tif<br>
       NED2/-114_34_-108_36.tif<br>
       NED2/-114_36_-108_38.tif<br>
       NED2/-114_38_-108_40.tif<br>
       NED2/-114_40_-108_42.tif<br>
       NED2/-114_42_-108_44.tif<br>
       NED2/-114_44_-108_46.tif<br>
       NED2/-114_46_-108_48.tif<br>
       NED2/-114_48_-108_50.tif<br>
       NED2/-120_32_-114_34.tif<br>
       NED2/-120_34_-114_36.tif<br>
       NED2/-120_36_-114_38.tif<br>
       NED2/-120_38_-114_40.tif<br>
       NED2/-120_40_-114_42.tif<br>
       NED2/-120_42_-114_44.tif<br>
       NED2/-120_44_-114_46.tif<br>
       NED2/-120_46_-114_48.tif<br>
       NED2/-120_48_-114_50.tif<br>
       NED2/-123_33_-120_37.tif<br>
       NED2/-125_37_-120_39.tif<br>
       NED2/-125_39_-120_42.tif<br>
       NED2/-126_42_-120_44.tif<br>
       NED2/-126_44_-120_46.tif<br>
       NED2/-126_46_-120_48.tif<br>
       NED2/-126_48_-120_50.tif<br>
       NED2/133_6.5_138.5_10.tif<br>
       NED2/-139.0019842_51.9997277_-127.0018384_58.9998127.tif<br>
       NED2/-139.0024054_58.9997472_-127.0018101_66.0000944.tif<br>
       NED2/144_13_146_16.tif<br>
       NED2/151_5_163.5_8.tif<br>
       NED2/-157_18_-152_23.tif<br>
       NED2/-157.5_18.75_-154.5_21.5.tif<br>
       NED2/-160.5_21_-157.5_22.5.tif<br>
       NED2/-162_18_-157_23.tif<br>
       NED2/-171_-14.5_-169_-14.tif<br>
       NED2/-68_17_-64_18.tif<br>
       NED2/-72.0002778_40.9999994_-67.9999992_44.tif<br>
       NED2/-72.0002778_44_-66_46.tif<br>
       NED2/-72.0002778_46_-66_48.tif<br>
       NED2/-78.0002778_33.0000047_-75.0000047_36.tif<br>
       NED2/-78.0002778_36_-72_38.tif<br>
       NED2/-78.0002778_38_-72_40.tif<br>
       NED2/-78.0002778_40_-72_42.tif<br>
       NED2/-78.0002778_42_-72_44.tif<br>
       NED2/-78.0002778_44_-72_46.tif<br>
       NED2/-84.0002778_24_-78_26.tif<br>
       NED2/-84.0002778_26_-78_28.tif<br>
       NED2/-84.0002778_28_-78_30.tif<br>
       NED2/-84.0002778_30_-78_32.tif<br>
       NED2/-84.0002778_32_-78_34.tif<br>
       NED2/-84.0002778_34_-78_36.tif<br>
       NED2/-84.0002778_36_-78_38.tif<br>
       NED2/-84.0002778_38_-78_40.tif<br>
       NED2/-84.0002778_40_-78_42.tif<br>
       NED2/-84.0002778_42_-78_44.tif<br>
       NED2/-85.0002778_44.0000047_-82.0000047_47.tif<br>
       NED2/-90_28_-84_30.tif<br>
       NED2/-90_30_-84_32.tif<br>
       NED2/-90_32_-84_34.tif<br>
       NED2/-90_34_-84_36.tif<br>
       NED2/-90_36_-84_38.tif<br>
       NED2/-90_38_-84_40.tif<br>
       NED2/-90_40_-84_42.tif<br>
       NED2/-90_42_-84_44.tif<br>
       NED2/-90_44_-85_46.tif<br>
       NED2/-90_46_-85_49.tif<br>
       NED2/-96_28_-90_30.tif<br>
       NED2/-96_30_-90_32.tif<br>
       NED2/-96_32_-90_34.tif<br>
       NED2/-96_34_-90_36.tif<br>
       NED2/-96_36_-90_38.tif<br>
       NED2/-96_38_-90_40.tif<br>
       NED2/-96_40_-90_42.tif<br>
       NED2/-96_42_-90_44.tif<br>
       NED2/-96_44_-90_46.tif<br>
       NED2/-96_46_-90_48.tif<br>
       NED2/-96_48_-90_50.tif<br>
Size is 1180816, 284173<br>
Coordinate System is:<br>
GEOGCS[&quot;WGS 84&quot;,<br>
    DATUM[&quot;WGS_1984&quot;,<br>
        SPHEROID[&quot;WGS 84&quot;,6378137,298.257223563,<br>
            AUTHORITY[&quot;EPSG&quot;,&quot;7030&quot;]],<br>
        AUTHORITY[&quot;EPSG&quot;,&quot;6326&quot;]],<br>
    PRIMEM[&quot;Greenwich&quot;,0],<br>
    UNIT[&quot;degree&quot;,0.0174532925199433],<br>
    AUTHORITY[&quot;EPSG&quot;,&quot;4326&quot;]]<br>
Origin = (-171.000000000113090,66.000094447240443)<br>
Pixel Size = (0.000283278659440,-0.000283278659440)<br>
Corner Coordinates:<br>
Upper Left  (-171.0000000,  66.0000944) (171d 0&#39;0.00&quot;W, 66d 0&#39;0.34&quot;N)<br>
Lower Left  (-171.0000000, -14.5000520) (171d 0&#39;0.00&quot;W, 14d30&#39;0.19&quot;S)<br>
Upper Right ( 163.4999735,  66.0000944) (163d29&#39;59.90&quot;E, 66d 0&#39;0.34&quot;N)<br>
Lower Right ( 163.4999735, -14.5000520) (163d29&#39;59.90&quot;E, 14d30&#39;0.19&quot;S)<br>
Center      (  -3.7500132,  25.7500212) (  3d45&#39;0.05&quot;W, 25d45&#39;0.08&quot;N)<br>
Band 1 Block=128x128 Type=Int16, ColorInterp=Gray<br>
  Minimum=-83.000, Maximum=4665.000, Mean=25.333, StdDev=189.129<br>
  Metadata:<br>
    STATISTICS_MINIMUM=-83<br>
    STATISTICS_MAXIMUM=4665<br>
    STATISTICS_MEAN=25.332848474484<br>
    STATISTICS_STDDEV=189.12886049417<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Chaitanya kumar CH.<br>/tʃaɪθənjə/ /kʊmɑr/ <br>+91-9494447584<br>17.2416N 80.1426E<br>