4

I'm trying to reproject the Natural Earth 2 raster layer (http://www.naturalearthdata.com/downloads/10m-raster-data/10m-natural-earth-2/) into the natural earth projection (http://en.wikipedia.org/wiki/Natural_Earth_projection) using gdalwarp.

The whole thing looks pretty good except I get 4 black squares by the edges of the map as seen below.

gdalwarp options used [gdalwarp included in QGIS: GDAL 1.11.0, released 2014/04/16]:

gdalwarp -overwrite -s_srs EPSG:4326 -t_srs "+proj=natearth +wktext" -r lanczos -of GTiff NE2_HR_LC_SR_W_DR.tif reprojected.tif

natearth reprojection with black squares

6

I can reproduce the error with another Natural Earth image http://naciscdn.org/naturalearth/10m/raster/NE2_LR_LC.zip and GDAL version 2.0-dev. Write a mail into gdal-dev mailing list. I believe that the issue is real and you can file next a ticket into GDAL bug tracker.

I also verified that problem is not caused by the lanczos resampling but "-r average" produces the same artifact.

Projection error of GDAL from EPSG:4326 into Natural Earth projection

Edit

As mentioned in an answer by Andre Joost, the issue can be fixed by adding parameter -wo SAMPLE_STEPS=1000 into the gdalwarp command. The whole explanation from gdal-devA is worth including here:

Adding -wo SAMPLE_STEPS=1000 fixes it (1000 is experimentally found. 100 was almost perfect, and then I just tried 1000). The default is 21.

The issue here is that the warper process by rectangular regions of the target dataset and then tries to find the rectangular region of the source dataset that matches. In the corners, which are full of target pixels without any valid source pixels, the default sampling logic doesn't manage to identify properly the source pixel region due to a too low sampling step.

The higher SAMPLE_STEPS, the slower the warping is (in theory, practical speed might depend on situations)

Playing with -wm has possibly an influence on the result too, but that might be even more magic to play with that.

  • Same here, tested with NASA's Blue Marble tif files. Strangely, the 2048 and 8192px wide sources do not produce the black edges, but the 21600px wide source does. – AndreJ Aug 22 '14 at 15:49
2

From the developers via GDAL-dev Mailing list:

The issue can be solved by using -wo SAMPLE_STEPS=1000

It even works for me with a value of 500:

gdalwarp -overwrite -s_srs EPSG:4326 -t_srs "+proj=natearth +wktext" -wo SAMPLE_STEPS=500 -of GTiff NE2_LR_LC.tif reprojected.tif

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.