[gdal-dev] Building a Mercator Image from Un-projected data..Majorconfusion and help requested.

Christopher Barker Chris.Barker at noaa.gov
Tue Nov 3 19:07:07 EST 2009

Cassanova, Bill wrote:
> Thank you for your response.

> Your email motivated me to try something.  Not sure it's quite right but
> it does seem closer:

It looks right at a quick glance, but note that you are essentially 
re-writing gdalwarp -- is that code too opaque to make use of?

> I ran the gdalwarp process on an unprojected image and as far as I can
> tell the image produced by this code and the image produced from that
> code are exactly the same.

right -- by default, gdalwarp uses nearest neighbor interpolation, which 
is pretty much what you've done. You might try one of the other 
interpolation methods, and see if the results look nicer:

$ gdalwarp
Usage: gdalwarp [--help-general] [--formats]
     [-s_srs srs_def] [-t_srs srs_def] [-to "NAME=VALUE"]
     [-order n] [-tps] [-rpc] [-geoloc] [-et err_threshold]
     [-te xmin ymin xmax ymax] [-tr xres yres] [-ts width height]
     [-wo "NAME=VALUE"] [-ot Byte/Int16/...] [-wt Byte/Int16]
     [-srcnodata "value [value...]"] [-dstnodata "value [value...]"] 
     [-r resampling_method] [-wm memory_in_mb] [-multi] [-q]
     [-cutline datasource] [-cl layer] [-cwhere expression]
     [-csql statement] [-cblend dist_in_pixels]
     [-of format] [-co "NAME=VALUE"]*
     srcfile* dstfile

Available resampling methods:
     near (default), bilinear, cubic, cubicspline, lanczos.

so you should be abel to do (untested):

gdalwarp -s_srs '+proj=merc' -r cubic 

It depends some on your image, but it could look quite a bit nicer.


Christopher Barker, Ph.D.

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov

More information about the gdal-dev mailing list