cdm/src/main/java/ucar/unidata/geoloc/ProjectionImpl.java
public LatLonRect projToLatLonBBold(ProjectionRect world) {
    //System.out.println("world = " + world);
    ProjectionPoint min = world.getMinPoint();
    ProjectionPoint max = world.getMaxPoint();
    //System.out.println("min = " + min);
    //System.out.println("max = " + max);
    LatLonRect llbb;
    LatLonPointImpl llmin = new LatLonPointImpl();
    LatLonPointImpl llmax = new LatLonPointImpl();

    // make bounding box out of the min, max corners
    projToLatLon(min, llmin);
    projToLatLon(max, llmax);
    llbb = new LatLonRect(llmin, llmax);
    //System.out.println("llbb = " + llbb);

    /*
   double lona = la.getLongitude();
   double lonb = lb.getLongitude();

   if (((lona < lonb) && (lonb - lona <= 180.0))
           || ((lona > lonb) && (lona - lonb >= 180.0))) {
       llbb = new LatLonRect(la, lb);
   } else {
       llbb = new LatLonRect(lb, la);
   } */

    ProjectionPointImpl w1 = new ProjectionPointImpl();
    ProjectionPointImpl w2 = new ProjectionPointImpl();

    // now extend if needed using the other two corners
    w1.setLocation(min.getX(), max.getY());
    projToLatLon(w1, llmin);
    llbb.extend(llmin);

    w2.setLocation(max.getX(), min.getY());
    projToLatLon(w2, llmax);
    llbb.extend(llmax);

    return llbb;
  }
public LatLonRect projToLatLonBBold(ProjectionRect world) {
    //System.out.println("world = " + world);
    ProjectionPoint min = world.getMinPoint();
    ProjectionPoint max = world.getMaxPoint();
    //System.out.println("min = " + min);
    //System.out.println("max = " + max);
    LatLonRect llbb;
    LatLonPointImpl llmin = new LatLonPointImpl();
    LatLonPointImpl llmax = new LatLonPointImpl();

    // make bounding box out of the min, max corners
    projToLatLon(min, llmin);
    projToLatLon(max, llmax);
    llbb = new LatLonRect(llmin, llmax);
    //System.out.println("llbb = " + llbb);

    /*
   double lona = la.getLongitude();
   double lonb = lb.getLongitude();

   if (((lona < lonb) && (lonb - lona <= 180.0))
           || ((lona > lonb) && (lona - lonb >= 180.0))) {
       llbb = new LatLonRect(la, lb);
   } else {
       llbb = new LatLonRect(lb, la);
   } */

    ProjectionPointImpl w1 = new ProjectionPointImpl();
    ProjectionPointImpl w2 = new ProjectionPointImpl();

    // now extend if needed using the other two corners
    w1.setLocation(min.getX(), max.getY());
    projToLatLon(w1, llmin);
    llbb.extend(llmin);

    w2.setLocation(max.getX(), min.getY());
    projToLatLon(w2, llmax);
    llbb.extend(llmax);

    return llbb;
  }
Convert a world coordinate bounding box to a lat/lon bounding box,
by finding the minimum enclosing box.

@param world input world coordinate bounding box
@return minimum enclosing box in lat,lon coordinates.