1

I am new to Geotools and I have to work on project which includes a set of tiff image maps. In that I need to get latitude/longitude for a given point.

Ex: When mouse click occurs I want to get the lat/long for the clicked point.

I tried following code snippet

frame.getMapPane().addMouseListener(
            new MapMouseAdapter(){
                public void onMouseClicked(MapMouseEvent ev) {

                    //DirectPosition2D pos = ev.getMapPosition();
                    //System.out.println(pos.x + " " + pos.y);
                    DirectPosition2D pos = ev.getWorldPos();
                    System.out.println(pos.x + " " + pos.y);

                }
            }

    );

Are these simply the X/Y coordinates for a given point?

I appreciate your help, thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.