[gdal-dev] GDAL_GRID Dateline Issue

pcreso at pcreso.com pcreso at pcreso.com
Thu Dec 27 13:39:12 PST 2012



> Hi,
> 
> I am trying to use gdal_grid to interpolate some data and I am having
> trouble making gdal_grid treat spatial data (WGS84 lat/lon coordinates) as
> points on a continuous plane.  It seems to be ignoring the dateline so for
> example values at 45, 179 are not properly interacting with values at 45,
> -179 and so on.  I'm using the following gdal_grid command:
> 

Hi Andrew, 

A common problem for us in New Zealand :-)

convert your data to 0-360 longitudinal space instead of +-180, it moves the problem to the other side of the world. Add 360 to all negative longitudes. One easy way, given that you'll have proj.4 installed with gdal:

Proj.4 supports the parameter "+lon_wrap" (ignored by proj, but supported in cs2cs) which assigns any given central meridian to the output coords, & you want a central meridian of 180 instead of 0. 

eg:
echo "179 -45 -179 -45" | cs2cs +proj=longlat +datum=WGS84 +to +proj=longlat +datum=WGS84+lon_wrap=180 -f '%0.6f'
179.000000      -45.000000 0.000000
181.000000      -45.000000 0.000000

Documented at:
http://trac.osgeo.org/proj/wiki/GenParms#lon_wrapover-LongitudeWrapping

HTH,

   Brent Wood
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20121227/0c340ff4/attachment.html>


More information about the gdal-dev mailing list