Suggestion

233
1
08-06-2019 06:21 AM
S_MMaruf
New Contributor II

I use mapView class in my java Application project to view an interactive map. By clicking on a separate button, I want the mapView's corner Coordinates. I am using mapView.getPolygon(). My problem is that i always get same polygon also when map already got panned by using "drag and drop". How do I ensure that i get updated corner coordinates after the "drag and drop"? what is the correct approach?

0 Kudos
1 Reply
MarkBaird
Esri Regular Contributor

Just want to make sure you are using the ArcGIS Runtime SDK for Java as in this:

https://developers.arcgis.com/java/

The reason I ask is that there isn't a getPolygon method on the JavaFX control in this API.

Also want to double check what you mean by "drag and drop"?  Are you just referring to panning the map to another location?

If you are after the current extent of you map, then you will be interested in the map's viewpoint.  The code below shows how you could use it.

mapView.addDrawStatusChangedListener(listener -> {
    System.out.println("draw status" + listener.getDrawStatus());
    Envelope extent = (Envelope) mapView.getCurrentViewpoint(Viewpoint.Type.BOUNDING_GEOMETRY).getTargetGeometry();
    if (listener.getDrawStatus() == DrawStatus.COMPLETED) {
        System.out.println("extent " + extent.toString());
    }
});

Does this help?

0 Kudos