[OpenMap Users] Bug in LLXY projection

From: Keith Alphonso <kalphonso@diamonddata.com>
Date: Thu Mar 25 2004 - 16:28:35 EST

I found the following bug in the LLXY projection code:

This is the code as it stands in ver 4.6
==============================================
    protected void computeParameters() {
        Debug.message("proj", "LLXY.computeParameters()");
        super.computeParameters();

        // compute the offsets
        hy = height/2;
        wx = width/2;
        // Degrees longitude of the center of the projection.
        cLon = ProjMath.radToDeg(ctrLon);
        cLat = ProjMath.radToDeg(ctrLat);
        ppd = world.x/360f;

        float latLimit = 90f - ((float)hy / ppd);

        if (cLat > latLimit) {
            cLat = latLimit;
            ctrLon = ProjMath.degToRad(cLat);
        } else if (cLat < -latLimit) {
            cLat = -latLimit;
            ctrLon = ProjMath.degToRad(cLat);
        }

        if (Debug.debugging("llxy")) {
            Debug.output("LLXY.computeParameters: with center lat:" + cLat +
                         ", lon:" + cLon + " | width:" + width +
                         ", height:" + height + " | scale:" + scale);
        }
    }

This is how I believe the code should look:
====================================================
    protected void computeParameters() {
        Debug.message("proj", "LLXY.computeParameters()");
        super.computeParameters();

        // compute the offsets
        hy = height/2;
        wx = width/2;
        // Degrees longitude of the center of the projection.
        cLon = ProjMath.radToDeg(ctrLon);
        cLat = ProjMath.radToDeg(ctrLat);
        ppd = world.x/360f;

        float latLimit = 90f - ((float)hy / ppd);

          //Add check for zoom allowing more than 90 degrees viewable
          if (latLimit < 0.0f)
                latLimit = 0.0f;

        if (cLat > latLimit) {
            cLat = latLimit;
            //Should set ctrLat here
                //ctrLon = ProjMath.degToRad(cLat);
            ctrLat = ProjMath.degToRad(cLat);
        } else if (cLat < -latLimit) {
            cLat = -latLimit;
            ctrLon = ProjMath.degToRad(cLat);
        }

        if (Debug.debugging("llxy")) {
            Debug.output("LLXY.computeParameters: with center lat:" + cLat +
                         ", lon:" + cLon + " | width:" + width +
                         ", height:" + height + " | scale:" + scale);
        }
    }

Do you agree with this assessment? With this change, the LLXY projection
will be shown centered instead of at the top, and the projection calcs work.

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu Mar 25 16:45:15 2004

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:38 EDT