Hi,
here is what Im using. Im new to GeoTools so feel free to correct me everyone!
I have this code in JMapPane:
public void mouseClicked(MouseEvent e) {
// get the geographic position the mouse is pointing to
DirectPosition2D geoCoords = getScreenToWorldPos(e.getPoint());
...
}
/**
* Convert Screen point to Map/World point
* @param point point on screen
* @return point in map
*/
public DirectPosition2D getScreenToWorldPos(Point point) {
assert ( point != null );
DirectPosition2D geoCoords = new DirectPosition2D(point.getX(),
point.getY());
AffineTransform t = getScreenToWorldTransform();
assert ( t != null );
t.transform(geoCoords, geoCoords);
geoCoords.setCoordinateReferenceSystem(getMapContext().getCoordinateReferenceSys
tem());
assert ( geoCoords != null );
return geoCoords;
}
Regards,
Alex
Von: khalid Amiral [mailto:[email protected]]
Gesendet: Mittwoch, 15. Juni 2011 00:25
An: [email protected]
Betreff: [Geotools-gt2-users] Get point from click mouse
Heloo,
please How can i get coordinates point after click mouse, because i want to use
it in WMS/GetFeatureInfo request (request.setQueryPoint(X,Y)).
if there is an example or tutorial will be better.
Thank you in advance
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users