[GRASS5] Import problem of worldwide maps fixed

Markus Neteler neteler at itc.it
Wed Mar 22 09:35:34 EST 2006


Hi,

I have (hopefully) solved a problem which sometimes appeared
when importing world maps. Sometimes those maps slightly
exceed -180 90 180 -90 which was then refused by GRASS.

I have added a modification to 
lib/gis/adj_cellhd.c

to check against an epsilon if the boundary coordinates
can be polished or not (to avoid that bad data slip in):

Example (Blue Marble from WMS):

gdalinfo ~/data/Image_BMNG_May_1080_2160.tif
Size is 2160, 1080
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.2572235630016,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (-180.000000,90.000000)
Pixel Size = (0.16666667,-0.16666667)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_SOFTWARE=SGI's Image Format Library/1.2
Corner Coordinates:
Upper Left  (-180.0000000,  90.0000000) (180d 0'0.00"W, 90d 0'0.00"N)
Lower Left  (-180.0000000, -90.0000054) (180d 0'0.00"W, 90d 0'0.02"S)
Upper Right ( 180.0000107,  90.0000000) (180d 0'0.04"E, 90d 0'0.00"N)
Lower Right ( 180.0000107, -90.0000054) (180d 0'0.04"E, 90d 0'0.02"S)
Center      (   0.0000054,  -0.0000027) (  0d 0'0.02"E,  0d 0'0.01"S)


r.in.gdal ~/data/Image_BMNG_May_1080_2160.tif out=b
A datum name wgs84 (WGS_1984) was specified without transformation parameters.
Note that the GRASS default for wgs84 is towgs84=0.000,0.000,0.000.
Projection of input dataset and current location appear to match.
Proceeding with import...
WARNING: Fixing subtle input data rounding error of south boundary
        (-5.36442e-06>9.25926e-07)
WARNING: Fixing subtle input data rounding error of east boundary
        (1.07288e-05>1e-06)
 100%
CREATING SUPPORT FILES FOR b.red
SETTING GREY COLOR TABLE FOR b.red (8bit, full range)
 100%
CREATING SUPPORT FILES FOR b.green
SETTING GREY COLOR TABLE FOR b.green (8bit, full range)
 100%
CREATING SUPPORT FILES FOR b.blue
SETTING GREY COLOR TABLE FOR b.blue (8bit, full range)


The WARNINGs indicate the new code in action.

#zoom to imported map
g.region rast=b.red -g
n=90
s=-90
w=-180
e=180
nsres=0.16666667
ewres=0.16666667
rows=1080
cols=2160

The numbers of rows/cols are the same, but the odd coordinates are
polished.

If maps exceed more than epsilon (hardcoded for East-West due to
global wrap around problems, for North-South calculated from number of
rows) the -180 90 180 -90 boundaries, the map will be rejected as
before (such as for the "natural Earth" data).

This will hopefully make life a bit easier when importing worldwide
maps.

Markus




More information about the grass-dev mailing list