I am trying to get current x and current y (lat/lng) on webmap ontouchlistener, As I have implemented webmap layer and trying to get click x and y but unable to get if anyone knows how to get please let me know
@NancySuez
Assuming you are writing a desktop JavaFX application (not a JavaScript web app), take a look at this sample application which listens to a setOnMouseClicked event and converts the screen coordinates to a WGS84 (lat / long) point.
Key steps are:
// click event to display the callout mapView.setOnMouseClicked(e -> { // check that the primary mouse button was clicked and user is not panning if (e.getButton() == MouseButton.PRIMARY && e.isStillSincePress()) { // create a point from where the user clicked Point2D point = new Point2D(e.getX(), e.getY()); // create a map point from a point Point mapPoint = mapView.screenToLocation(point); // project user-tapped map point location Point projectedPoint = (Point)GeometryEngine.project(mapPoint, SpatialReferences.getWgs84());
Does this help?
@MarkBaird Thankyou for sharing the solution....Its working
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.