Skip to content

Commit 586e5d3

Browse files
committed
update callout title, use WKIDs for spatial references
1 parent 50e5b22 commit 586e5d3

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed
-3.75 KB
Loading

src/main/java/com/esri/samples/geometry/project/ProjectSample.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.esri.arcgisruntime.geometry.Geometry;
3030
import com.esri.arcgisruntime.geometry.GeometryEngine;
3131
import com.esri.arcgisruntime.geometry.Point;
32+
import com.esri.arcgisruntime.geometry.SpatialReference;
3233
import com.esri.arcgisruntime.geometry.SpatialReferences;
3334
import com.esri.arcgisruntime.mapping.ArcGISMap;
3435
import com.esri.arcgisruntime.mapping.Basemap;
@@ -58,7 +59,8 @@ public void start(Stage stage) {
5859
stage.show();
5960

6061
// create a map with a web mercator basemap
61-
ArcGISMap map = new ArcGISMap(SpatialReferences.getWebMercator());
62+
System.out.println(SpatialReferences.getWebMercator().getWkid());
63+
ArcGISMap map = new ArcGISMap(SpatialReference.create(3857));
6264
map.setBasemap(Basemap.createNationalGeographic());
6365
mapView = new MapView();
6466
mapView.setMap(map);
@@ -87,11 +89,11 @@ public void start(Stage stage) {
8789
// show the clicked location on the map with a graphic
8890
Point originalPoint = mapView.screenToLocation(point2D);
8991
inputPointGraphic.setGeometry(originalPoint);
90-
// project the web mercator point to WGS84
91-
Point projectedPoint = (Point) GeometryEngine.project(originalPoint, SpatialReferences.getWgs84());
92+
// project the web mercator point to WGS84 (WKID 4326)
93+
Point projectedPoint = (Point) GeometryEngine.project(originalPoint, SpatialReference.create(4236));
9294
// show the original and projected point coordinates in a callout from the graphic
9395
Callout callout = mapView.getCallout();
94-
callout.setTitle("Projection");
96+
callout.setTitle("Coordinates");
9597
String ox = decimalFormat.format(originalPoint.getX());
9698
String oy = decimalFormat.format(originalPoint.getY());
9799
String px = decimalFormat.format(projectedPoint.getX());

0 commit comments

Comments
 (0)