[gdal-dev] Import raw binary with pixel-geolocation

Andrew Brooks arb at sat.dundee.ac.uk
Thu Jul 17 07:09:16 EDT 2008


On Tue, 01 Jul 2008 13:32:17 +0100, Frank Warmerdam <warmerdam at pobox.com> wrote:
>
> Andrew Brooks wrote:
>>
>> Is it possible to import/warp raw binary data which has no projection just
>> associated arrays of latitude/longitude for each pixel?
>
> You can make the raw binary available for use in GDAL by writing an XML VRT
> file that describes the raw binary file(s).

For the benefit of others I will describe how to do this below.

However there is a problem: warping is done in the reverse direction so the
output image end up full of holes, especially at the edges.

See http://www.sat.dundee.ac.uk/~arb/gdalwarp.jpg

Is there an option to perform the warping in the opposite direction (mapping
each image pixel into the raw data) ?

If not, is there an option to perform dilation?

Andrew


Sample VRT file for the image data contains pointers to two other VRT files,
one for latitude and one for longitude:

<VRTDataset rasterXSize="2048" rasterYSize="964">
   <Metadata domain="GEOLOCATION">
     <MDI key="X_DATASET">N11_part.lon.vrt</MDI>
     <MDI key="X_BAND">1</MDI>
     <MDI key="Y_DATASET">N11_part.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>GEOGCS[&quot;WGS 72&quot;,DATUM[&quot;WGS_1972&quot;,SPHEROID[&quot;WGS 72&quot;,6378135,298.26,AUTHORITY[&quot;EPSG&quot;,&quot;7043&quot;]],AUTHORITY[&quot;EPSG&quot;,&quot;6322&quot;]],PRIMEM[&quot;Greenwich&quot;,0,AUTHORITY[&quot;EPSG&quot;,&quot;8901&quot;]],UNIT[&quot;degree&quot;,0.01745329251994328,AUTHORITY[&quot;EPSG&quot;,&quot;9122&quot;]],AUTHORITY[&quot;EPSG&quot;,&quot;4322&quot;]]</SRS>
   <VRTRasterBand dataType="UInt16" band="1" subClass="VRTRawRasterBand">
     <ColorInterp>Red</ColorInterp>
	<SourceFilename relativetoVRT="1">N11_part.dat</SourceFilename>
     <ImageOffset>1500</ImageOffset>
     <PixelOffset>10</PixelOffset>
     <LineOffset>22180</LineOffset>
     <ByteOrder>LSB</ByteOrder>
   </VRTRasterBand>
</VRTDataset>

The image data is in the file N11_part.dat.

The VRT file for the latitude (N11_part.lat.vrt in this example) :

<VRTDataset rasterXSize="2048" rasterYSize="964">
   <SRS>GEOGCS[&quot;WGS 72&quot;,DATUM[&quot;WGS_1972&quot;,SPHEROID[&quot;WGS 72&quot;,6378135,298.26,AUTHORITY[&quot;EPSG&quot;,&quot;7043&quot;]],AUTHORITY[&quot;EPSG&quot;,&quot;6322&quot;]],PRIMEM[&quot;Greenwich&quot;,0,AUTHORITY[&quot;EPSG&quot;,&quot;8901&quot;]],UNIT[&quot;degree&quot;,0.01745329251994328,AUTHORITY[&quot;EPSG&quot;,&quot;9122&quot;]],AUTHORITY[&quot;EPSG&quot;,&quot;4322&quot;]]</SRS>
   <VRTRasterBand dataType="Float32" band="1" subClass="VRTRawRasterBand">
	<SourceFilename relativetoVRT="1">N11_part.lat</SourceFilename>
     <ByteOrder>LSB</ByteOrder>
   </VRTRasterBand>
</VRTDataset>

The latitude data is in the file N11_part.lat.

-- 


More information about the gdal-dev mailing list