[GRASS-dev] Re: [GRASS GIS] #352: r.in.gdal region troubles in LL

GRASS GIS trac at osgeo.org
Thu Oct 30 22:40:04 EDT 2008


#352: r.in.gdal region troubles in LL
--------------------------+-------------------------------------------------
  Reporter:  neteler      |       Owner:  grass-dev at lists.osgeo.org
      Type:  defect       |      Status:  new                      
  Priority:  major        |   Milestone:  6.4.0                    
 Component:  default      |     Version:  unspecified              
Resolution:               |    Keywords:                           
  Platform:  Unspecified  |         Cpu:  Unspecified              
--------------------------+-------------------------------------------------
Comment (by glynn):

 Replying to [ticket:352 neteler]:

 > The GeoTIFF file http://aloboaleu.googlepages.com/npp.tif (3.3MB) is
 causing problems in the region settings when imported with r.in.gdal:

 > gdalinfo npp.tif

 > Pixel Size = (0.250000000000200,-0.250000000000200)

 It's that extra 0.0000000000002 that's causing the problems:

 {{{
 > print adfGeoTransform
 $2 = {-180, 0.25000000000020001, 0, 85.000000000114397, 0,
   -0.25000000000020001}

 > print cellhd
 $3 = {format = -1215084252, compressed = -1208408148, rows = 572,
   rows3 = 572, cols = 1440, cols3 = 1440, depths = 1, proj = -1215649599,
   zone = -1215082992, ew_res = 0.25000000000020001,
   ew_res3 = 0.25000000000020001, ns_res = 0.25000000000020001,
   ns_res3 = 0.25000000000020001, tb_res = 1, north = 85.000000000114397,
   south = -58.000000000000007, east = 180.000000000288, west = -180, top =
 1,
   bottom = 0}
 }}}

 Note the "east = 180.000000000288" part. The cellhd structure never
 changes, but the value is wrapped when written to the cellhd file.
 Essentially, the map is ever so slightly more than 360 degrees wide.

 > Apparently the global wrap-around recognition is failing for 180W/E.

 No, it's the wrap-around which causes the problem.

 [And which will forever cause problems. We'll just have to work around
 them as we find them. Almost everything that you "know" about coordinate
 geometry is wrong for spherical geometry. E.g. just because x1 == x2, that
 doesn't mean that x1-x0 == x2-x0.]

 So how do you want to "fix" this? Clamp east to west+360? Clamp west to
 east-360? Clamp both to (west+east)/2 +/- 180? What if the map is
 significantly more than 360 degrees wide?

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/352#comment:1>
GRASS GIS <http://grass.osgeo.org>


More information about the grass-dev mailing list