|
29 | 29 | import com.esri.arcgisruntime.geometry.Geometry; |
30 | 30 | import com.esri.arcgisruntime.geometry.GeometryEngine; |
31 | 31 | import com.esri.arcgisruntime.geometry.Point; |
| 32 | +import com.esri.arcgisruntime.geometry.SpatialReference; |
32 | 33 | import com.esri.arcgisruntime.geometry.SpatialReferences; |
33 | 34 | import com.esri.arcgisruntime.mapping.ArcGISMap; |
34 | 35 | import com.esri.arcgisruntime.mapping.Basemap; |
@@ -58,7 +59,8 @@ public void start(Stage stage) { |
58 | 59 | stage.show(); |
59 | 60 |
|
60 | 61 | // 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)); |
62 | 64 | map.setBasemap(Basemap.createNationalGeographic()); |
63 | 65 | mapView = new MapView(); |
64 | 66 | mapView.setMap(map); |
@@ -87,11 +89,11 @@ public void start(Stage stage) { |
87 | 89 | // show the clicked location on the map with a graphic |
88 | 90 | Point originalPoint = mapView.screenToLocation(point2D); |
89 | 91 | 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)); |
92 | 94 | // show the original and projected point coordinates in a callout from the graphic |
93 | 95 | Callout callout = mapView.getCallout(); |
94 | | - callout.setTitle("Projection"); |
| 96 | + callout.setTitle("Coordinates"); |
95 | 97 | String ox = decimalFormat.format(originalPoint.getX()); |
96 | 98 | String oy = decimalFormat.format(originalPoint.getY()); |
97 | 99 | String px = decimalFormat.format(projectedPoint.getX()); |
|
0 commit comments