[gdal-dev] gdal_warp

John Donovan j.donovan at virtalis.com
Mon Jun 21 06:54:56 EDT 2010


I've got a slightly older version of the data you're using (OS 10k B&W,
but with 2 bits per pixel rather than four), and I've used a two-stage
process to achieve what you want.
 
First, I used gdal_translate to expand the image to 8-bit greyscale:
gdal_translate -co "TFW=YES" -co "TILED=YES" -expand gray TQ00NE.TIF
out1.tif
 
Then warped and compressed it with gdalwarp:
gdalwarp -s_srs "EPSG:27700" -t_srs "EPSG:4326" -co "TFW=YES" -co
"TILED=YES" -co "NBITS=2" -co "COMPRESS=LZW" -dstnodata 3 out1.tif
out2.tif
 
This gives me:
Driver: GTiff/GeoTIFF
Files: out2.tif
       out2.tfw
Size is 9687, 6132
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 = (-0.510285477808487,50.879964362399022)
Pixel Size = (0.000007481610932,-0.000007481610932)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  -0.5102855,  50.8799644) (  0d30'37.03"W, 50d52'47.87"N)
Lower Left  (  -0.5102855,  50.8340871) (  0d30'37.03"W, 50d50'2.71"N)
Upper Right (  -0.4378111,  50.8799644) (  0d26'16.12"W, 50d52'47.87"N)
Lower Right (  -0.4378111,  50.8340871) (  0d26'16.12"W, 50d50'2.71"N)
Center      (  -0.4740483,  50.8570257) (  0d28'26.57"W, 50d51'25.29"N)
Band 1 Block=256x256 Type=Byte, ColorInterp=Gray
  NoData Value=3
  Image Structure Metadata:
    NBITS=2

An issue you may have is that because you're reprojecting a map, text
gets squashed a bit, and stipple patterns look a bit rough, but it's
certainly usable, and creates a file that is (in this case) less than
100k larger than the original. Different compression algorithms may
yield smaller files, as will changing the tile size possibly.

-JD

______________________________________________________________________
This email has been scanned for Virtalis Ltd by the MessageLabs Email Security System. ______________________________________________________________________


More information about the gdal-dev mailing list