[gdal-dev] Warp a file from two separate Lat and Long

pcreso at pcreso.com pcreso at pcreso.com
Thu Feb 18 13:14:28 EST 2010


assuming you are using Linux....

Can you use paste to merge the files first, redirected into a new file of x y z columns, then use GDAL on the result (assuming the order of values is the same in all 3 files)

eg:

echo 1 > f1
echo 2 > f2
echo 3 > f3
paste f1 f2 f3
1       2       3


Brent Wood


--- On Fri, 2/19/10, Andrew Brooks <arb at sat.dundee.ac.uk> wrote:

> From: Andrew Brooks <arb at sat.dundee.ac.uk>
> Subject: Re: [gdal-dev] Warp a file from two separate Lat and Long
> To: "gdal-dev" <gdal-dev at lists.osgeo.org>
> Date: Friday, February 19, 2010, 6:42 AM
> On Thu, 18 Feb 2010 16:49:36 -0000,
> Luisa Peña <luisapena1979 at gmail.com>
> wrote:
> > 
> > I've used GDAL a few times but this is the first time
> that I'm lost on what
> > I can do with GDAL to solve my problem. I have 3
> separate files, one with my
> > data, other with Lattitude and another with Longitude.
> They have the same
> > size and, as an example,  it means that Pixel
> (1,1) of data is located in
> > latitude retrieved from Pixel (1,1) from latitude and
> longitude (pixel (1,1)
> > from longitude). All of them are in WGS84 but without
> GCP's points.
> > I need to create a georreferenced/rectified Geotiff
> with this data and, to
> > do that, I need lat and Long. How can I do this?
> 
> In the past it has been suggested to use VRT files for this
> (don't know if
> that's still the best solution?).
> 
> Create one VRT file which describes the Latitude file
> Create one VRT file which describes the Longitude file
> Create one VRT file which describes the data and references
> the
> lat and lon VRT files as GEOLOCATION metadata.
> 
> The latter VRT file is the one you reference as the source
> image to a
> gdalwarp/translate command.  It's all actually quite
> simple (see examples
> below) but if you need some more specific advice then let
> me know.
> 
> Andrew
> 
> 
> Example VRT file for latitude:
> 
> <VRTDataset rasterXSize="2048" rasterYSize="964">
>   <SRS>GEOGCS[&quot;WGS
> 72&quot;,DATUM[&quot;WGS_1972&quot;,SPHEROID[&quot;WGS
> 7
> 2&quot;,6378135,298.26,AUTHORITY[&quot;EPSG&quot;,&quot;7043&quot;]],AUTHORITY[&
> quot;EPSG&quot;,&quot;6322&quot;]],PRIMEM[&quot;Greenwich&quot;,0,AUTHORITY[&quo
> t;EPSG&quot;,&quot;8901&quot;]],UNIT[&quot;degree&quot;,0.01745329251994328,AUTH
> ORITY[&quot;EPSG&quot;,&quot;9122&quot;]],AUTHORITY[&quot;EPSG&quot;,&quot;4322&
> quot;]]</SRS>
>   <VRTRasterBand dataType="Float32" band="1"
> subClass="VRTRawRasterBand">
>         <SourceFilename
> relativetoVRT="1">data.lat</SourceFilename>
>     <ByteOrder>LSB</ByteOrder>
>   </VRTRasterBand>
> </VRTDataset>
> 
> Example VRT file for data (just to show the geolocation
> metadata reference):
> 
> <VRTDataset rasterXSize="2048" rasterYSize="964">
>   <Metadata domain="GEOLOCATION">
>     <MDI
> key="X_DATASET">data.lon.vrt</MDI>
>     <MDI key="X_BAND">1</MDI>
>     <MDI
> key="Y_DATASET">data.lat.vrt</MDI>
>     <MDI key="Y_BAND">1</MDI>
>     <MDI key="PIXEL_OFFSET">0</MDI>
>     <MDI key="LINE_OFFSET">0</MDI>
>     <MDI key="PIXEL_STEP">1</MDI>
>     <MDI key="LINE_STEP">1</MDI>
>   </Metadata>
>   <SRS> stuff goes here</SRS>
> 
>   <VRTRasterBand dataType="UInt16" band="1"
> subClass="VRTRawRasterBand">
>     <ImageOffset>1500</ImageOffset>
>     <PixelOffset>10</PixelOffset>
>     <LineOffset>22180</LineOffset>
>     <ByteOrder>LSB</ByteOrder>
>   </VRTRasterBand>
> </VRTDataset>
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
> 


More information about the gdal-dev mailing list