Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DTEDFrameCache index out of bound - with all DTED frames ! #2

Open
GoogleCodeExporter opened this issue Aug 3, 2015 · 0 comments
Open

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Import DTED0 Files from 
http://geoengine.nga.mil/geospatial/SW_TOOLS/NIMAMUSE/webinter/rast_roam.html
2. IN DTEDFrameCache try:

public static void main(String[] args) {
        Debug.init();
        //if (args.length < 1) {
        //    Debug.output("DTEDFrameCache:  Need a path/filename");
        //    System.exit(0);
        //}

        //Debug.output("DTEDFrameCache: " + args[0]);
        DTEDDirectoryHandler directorHandlerDTED0 = new DTEDDirectoryHandler();
        StandardDTEDNameTranslator standDTED = new StandardDTEDNameTranslator();
        standDTED.setDTEDDir("/data/terrain/dted0");
        directorHandlerDTED0.setDirectoryPath("/data/terrain/dted0");
        directorHandlerDTED0.setTranslator(standDTED);
        Vector handlers = new Vector();
        handlers.addElement(directorHandlerDTED0);

        DTEDFrameCache dfc = new DTEDFrameCache(10);
        dfc.setDTEDDirectoryHandlers(handlers);

        // 35.965065 -121.198715
        // 35.998 36.002 lon -121.002 -120.998
        float ullat = 56.3956761006288f; //37.002f;
        float ullon = 14.7773809523808f; //-121.002f;
        float lrlat = 48.8873427672958f; //35.998f;
        float lrlon = 29.7940476190478f; //-119.998f;

        // System.out.println("Getting elevations for " +
        // ullat + ", " + ullon + ", " +
        // lrlat + ", " + lrlon);
        short[][] e = dfc.getElevations(ullat, ullon, lrlat, lrlon, 0);
        if (e != null) {
            for (int i = e[0].length - 1; i >= 0; i--) {
                int col = 0;
                System.out.print("r" + i + "-");
                for (int j = 0; j < e.length; j++) {
                    System.out.print(e[j][i] + " ");
                    col++;
                }
                System.out.println(" - " + col);
            }
        }

    }
3. index out of bound error on 
System.arraycopy(es[x][y][i],
                                0,
                                matrix[i + xspacer],
                                yspacer,
                                es[x][y][i].length);

Solution: short[][] matrix = new short[xLength + 47][yLength]; //TODO why 47 ?

What is the expected output? What do you see instead?

index out of bound error on 
System.arraycopy(es[x][y][i],
                                0,
                                matrix[i + xspacer],
                                yspacer,
                                es[x][y][i].length);

What version of the product are you using? On what operating system?
5.01 - Windows

Please provide any additional information below.


Original issue reported on code.google.com by guerreiro.nma on 27 Oct 2013 at 6:50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant