8277 y -= eps_; 00278 else 00279 throw GeographicErr("Northing " + Utility::str(int(floor(y/1000))) 00280 + "km not in MGRS/" 00281 + (utmp ? "UTM" : "UPS") + " range for " 00282 + (northp ? "N" : "S" ) + " hemisphere [" 00283 + Utility::str(minnorthing_[ind]*tile_/1000) 00284 + "km, " 00285 + Utility::str(maxnorthing_[ind]*tile_/1000) 00286 + "km)"); 00287 } 00288 00289 // Correct the UTM northing and hemisphere if necessary 00290 if (utmp) { 00291 if (northp && iy < minutmNrow_) { 00292 northp = false; 00293 y += utmNshift_; 00294 } else if (!northp && iy >= maxutmSrow_) { 00295 if (y == maxutmSrow_ * tile_) 00296 // If on equator retain S hemisphere 00297 y -= eps_; 00298 else { 00299 northp = true; 00300 y -= utmNshift_; 00301 } 00302 } 00303 } 00304 } 00305 00306 int MGRS::UTMRow(int iband, int icol, int irow) throw() { 00307 // Input is MGRS (periodic) row index and output is true row index. Band 00308 // index is in [-10, 10) (as returned by LatitudeBand). Column index 00309 // origin is easting = 100km. Returns maxutmSrow_ if irow and iband are 00310 // incompatible. Row index origin is equator. 00311 00312 // Estimate center row number for latitude band 00313 // 90 deg = 100 tiles; 1 band = 8 deg = 100*8/90 tiles 00314 real c = 100 * (8 * iband + 4)/real(90); 00315 bool northp = iband >= 0; 00316 int 00317 minrow = iband > -10 ? 00318 int(floor(c - real(4.3) - real(0.1) * northp)) : -90, 00319 maxrow = iband < 9 ? 00320 int(floor(c + real(4.4) -