Skip to content

Commit 112223d

Browse files
authored
New Basemaps: Hydrography, Image layers and KML Categories (#603)
* Hydrography - add enc exchange set * Change sublayer renderer * Map image sublayer visibility * Map image layer tables * Query map image sublayer * Create and save kml file * Display kml * Identify kml features * Change sublayer renderer - set viewpoint on mapview * Map image subayer visibility - set viewpoint on mapview * Add ENC exchange set - adjust mapview setup * Query map image sublayer - tidy up viewpoint setting * Display KML - tidy comments * Update build.gradle - verisons * Tidy up comment and scale consistencies
1 parent b669974 commit 112223d

File tree

16 files changed

+105
-50
lines changed

16 files changed

+105
-50
lines changed

hydrography/add-enc-exchange-set/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
group = 'com.esri.samples'
77

88
ext {
9-
arcgisVersion = '100.9.0'
9+
arcgisVersion = '100.10.0-2992'
1010
}
1111

1212
javafx {

hydrography/add-enc-exchange-set/src/main/java/com/esri/samples/add_enc_exchange_set/AddEncExchangeSetSample.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import javafx.scene.layout.StackPane;
2828
import javafx.stage.Stage;
2929

30+
import com.esri.arcgisruntime.ArcGISRuntimeEnvironment;
3031
import com.esri.arcgisruntime.geometry.Envelope;
3132
import com.esri.arcgisruntime.geometry.GeometryEngine;
3233
import com.esri.arcgisruntime.hydrography.EncCell;
@@ -35,7 +36,7 @@
3536
import com.esri.arcgisruntime.layers.EncLayer;
3637
import com.esri.arcgisruntime.loadable.LoadStatus;
3738
import com.esri.arcgisruntime.mapping.ArcGISMap;
38-
import com.esri.arcgisruntime.mapping.Basemap;
39+
import com.esri.arcgisruntime.mapping.BasemapStyle;
3940
import com.esri.arcgisruntime.mapping.Viewpoint;
4041
import com.esri.arcgisruntime.mapping.view.DrawStatus;
4142
import com.esri.arcgisruntime.mapping.view.MapView;
@@ -63,9 +64,16 @@ public void start(Stage stage) {
6364
stage.setScene(scene);
6465
stage.show();
6566

66-
// create a map view and add it to the stack pane
67+
// authentication with an API key or named user is required to access basemaps and other location services
68+
String yourAPIKey = System.getProperty("apiKey");
69+
ArcGISRuntimeEnvironment.setApiKey(yourAPIKey);
70+
71+
// create a map with the oceans basemap style
72+
ArcGISMap map = new ArcGISMap(BasemapStyle.ARCGIS_OCEANS);
73+
74+
// create a map view and set the map to it
6775
mapView = new MapView();
68-
stackPane.getChildren().add(mapView);
76+
mapView.setMap(map);
6977

7078
// show progress indicator when map is drawing
7179
ProgressIndicator progressIndicator = new ProgressIndicator();
@@ -83,10 +91,6 @@ public void start(Stage stage) {
8391
}
8492
});
8593

86-
// create a map with the Oceans basemap and set it on the map view
87-
ArcGISMap map = new ArcGISMap(Basemap.createOceans());
88-
mapView.setMap(map);
89-
9094
// load the ENC exchange set from local data
9195
File encPath = new File(System.getProperty("data.dir"), "./samples-data/enc/ExchangeSetwithoutUpdates/ENC_ROOT/CATALOG.031");
9296
encExchangeSet = new EncExchangeSet(Collections.singletonList(encPath.getAbsolutePath()));
@@ -118,6 +122,10 @@ public void start(Stage stage) {
118122
new Alert(Alert.AlertType.ERROR, "Failed to load ENC exchange set.").show();
119123
}
120124
});
125+
126+
// add the map view to the stack pane
127+
stackPane.getChildren().add(mapView);
128+
121129
} catch (Exception e) {
122130
// on any error, display the stack trace.
123131
e.printStackTrace();

image_layers/change-sublayer-renderer/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
group = 'com.esri.samples'
77

88
ext {
9-
arcgisVersion = '100.9.0'
9+
arcgisVersion = '100.10.0-2992'
1010
}
1111

1212
javafx {

image_layers/change-sublayer-renderer/src/main/java/com/esri/samples/change_sublayer_renderer/ChangeSublayerRendererSample.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@
2828
import javafx.scene.paint.Color;
2929
import javafx.stage.Stage;
3030

31+
import com.esri.arcgisruntime.ArcGISRuntimeEnvironment;
3132
import com.esri.arcgisruntime.layers.ArcGISMapImageLayer;
3233
import com.esri.arcgisruntime.layers.ArcGISMapImageSublayer;
3334
import com.esri.arcgisruntime.layers.SublayerList;
3435
import com.esri.arcgisruntime.loadable.LoadStatus;
3536
import com.esri.arcgisruntime.mapping.ArcGISMap;
36-
import com.esri.arcgisruntime.mapping.Basemap;
37+
import com.esri.arcgisruntime.mapping.BasemapStyle;
38+
import com.esri.arcgisruntime.mapping.Viewpoint;
3739
import com.esri.arcgisruntime.mapping.view.MapView;
3840
import com.esri.arcgisruntime.symbology.ClassBreaksRenderer;
3941
import com.esri.arcgisruntime.symbology.ClassBreaksRenderer.ClassBreak;
@@ -63,11 +65,20 @@ public void start(Stage stage) {
6365
stage.setScene(scene);
6466
stage.show();
6567

66-
// create a map and set it to the map view
67-
ArcGISMap map = new ArcGISMap(Basemap.Type.STREETS, 48.354406, -99.998267, 2);
68+
// authentication with an API key or named user is required to access basemaps and other location services
69+
String yourAPIKey = System.getProperty("apiKey");
70+
ArcGISRuntimeEnvironment.setApiKey(yourAPIKey);
71+
72+
// create a map with the streets basemap style
73+
ArcGISMap map = new ArcGISMap(BasemapStyle.ARCGIS_STREETS);
74+
75+
// create a map view and set the map to it
6876
mapView = new MapView();
6977
mapView.setMap(map);
7078

79+
// set a viewpoint on the map view
80+
mapView.setViewpoint(new Viewpoint(48.354406, -99.998267, 147914382));
81+
7182
// create a button to apply the render (set up later)
7283
Button rendererButton = new Button("Change sublayer renderer");
7384
// disable until the sublayer is loaded
@@ -91,7 +102,7 @@ public void start(Stage stage) {
91102
}
92103
});
93104

94-
// add the layer to the map
105+
// add the map image layer to the map's operational layers
95106
map.getOperationalLayers().add(imageLayer);
96107

97108
// create a class breaks renderer to switch to
@@ -104,7 +115,7 @@ public void start(Stage stage) {
104115
rendererButton.setDisable(true);
105116
});
106117

107-
// add the MapView and checkboxes
118+
// add the map view and button to the stack pane
108119
stackPane.getChildren().addAll(mapView, rendererButton);
109120
StackPane.setAlignment(rendererButton, Pos.TOP_LEFT);
110121
StackPane.setMargin(rendererButton, new Insets(10, 0, 0, 10));

image_layers/map-image-layer-sublayer-visibility/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
group = 'com.esri.samples'
77

88
ext {
9-
arcgisVersion = '100.9.0'
9+
arcgisVersion = '100.10.0-2992'
1010
}
1111

1212
javafx {

image_layers/map-image-layer-sublayer-visibility/src/main/java/com/esri/samples/map_image_layer_sublayer_visibility/MapImageLayerSublayerVisibilitySample.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@
3030
import javafx.scene.paint.Paint;
3131
import javafx.stage.Stage;
3232

33+
import com.esri.arcgisruntime.ArcGISRuntimeEnvironment;
3334
import com.esri.arcgisruntime.layers.ArcGISMapImageLayer;
3435
import com.esri.arcgisruntime.layers.SublayerList;
3536
import com.esri.arcgisruntime.loadable.LoadStatus;
3637
import com.esri.arcgisruntime.mapping.ArcGISMap;
37-
import com.esri.arcgisruntime.mapping.Basemap;
38+
import com.esri.arcgisruntime.mapping.BasemapStyle;
39+
import com.esri.arcgisruntime.mapping.Viewpoint;
3840
import com.esri.arcgisruntime.mapping.view.MapView;
3941

4042
public class MapImageLayerSublayerVisibilitySample extends Application {
@@ -57,6 +59,10 @@ public void start(Stage stage) {
5759
stage.setScene(scene);
5860
stage.show();
5961

62+
// authentication with an API key or named user is required to access basemaps and other location services
63+
String yourAPIKey = System.getProperty("apiKey");
64+
ArcGISRuntimeEnvironment.setApiKey(yourAPIKey);
65+
6066
// create a control panel
6167
VBox controlsVBox = new VBox(6);
6268
controlsVBox.setBackground(new Background(new BackgroundFill(Paint.valueOf("rgba(0,0,0,0.3)"), CornerRadii.EMPTY,
@@ -73,17 +79,20 @@ public void start(Stage stage) {
7379
controlsVBox.getChildren().addAll(citiesBox, continentsBox, worldBox);
7480
controlsVBox.getChildren().forEach(c -> ((CheckBox) c).setSelected(true));
7581

76-
// create a map view
77-
mapView = new MapView();
82+
// create a map with the topographic basemap style
83+
ArcGISMap map = new ArcGISMap(BasemapStyle.ARCGIS_TOPOGRAPHIC);
7884

79-
// create an ArcGISMap with the topographic basemap and set it to the map view
80-
ArcGISMap map = new ArcGISMap(Basemap.Type.TOPOGRAPHIC, 48.354406, -99.998267, 2);
85+
// create a map view and set the map to it
86+
mapView = new MapView();
8187
mapView.setMap(map);
8288

83-
// create a Image Layer with dynamically generated ArcGISMap images
89+
// set a viewpoint on the map view
90+
mapView.setViewpoint(new Viewpoint(48.354406, -99.998267, 147914382));
91+
92+
// create an image Layer with dynamically generated ArcGISMap images
8493
ArcGISMapImageLayer imageLayer = new ArcGISMapImageLayer("https://sampleserver6.arcgisonline.com/arcgis/rest/services/SampleWorldCities/MapServer");
8594

86-
// add world cities layers as ArcGISMap operational layer
95+
// add the image layer to the map's operational layers
8796
map.getOperationalLayers().add(imageLayer);
8897

8998
// set the image layer's opacity so that the basemap is visible behind it
@@ -106,7 +115,7 @@ public void start(Stage stage) {
106115
}
107116
});
108117

109-
// add the MapView and checkboxes
118+
// add the map view and controls to the stack pane
110119
stackPane.getChildren().addAll(mapView, controlsVBox);
111120
StackPane.setAlignment(controlsVBox, Pos.TOP_LEFT);
112121
StackPane.setMargin(controlsVBox, new Insets(10, 0, 0, 10));

image_layers/map-image-layer-tables/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
group = 'com.esri.samples'
77

88
ext {
9-
arcgisVersion = '100.9.0'
9+
arcgisVersion = '100.10.0-2992'
1010
}
1111

1212
javafx {

image_layers/map-image-layer-tables/src/main/java/com/esri/samples/map_image_layer_tables/MapImageLayerTablesSample.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import javafx.scene.layout.StackPane;
3030
import javafx.stage.Stage;
3131

32+
import com.esri.arcgisruntime.ArcGISRuntimeEnvironment;
3233
import com.esri.arcgisruntime.arcgisservices.RelationshipInfo;
3334
import com.esri.arcgisruntime.concurrent.ListenableFuture;
3435
import com.esri.arcgisruntime.data.ArcGISFeature;
@@ -42,7 +43,7 @@
4243
import com.esri.arcgisruntime.layers.ArcGISMapImageLayer;
4344
import com.esri.arcgisruntime.loadable.LoadStatus;
4445
import com.esri.arcgisruntime.mapping.ArcGISMap;
45-
import com.esri.arcgisruntime.mapping.Basemap;
46+
import com.esri.arcgisruntime.mapping.BasemapStyle;
4647
import com.esri.arcgisruntime.mapping.Viewpoint;
4748
import com.esri.arcgisruntime.mapping.view.Graphic;
4849
import com.esri.arcgisruntime.mapping.view.GraphicsOverlay;
@@ -84,10 +85,14 @@ public void start(Stage stage) {
8485
stage.setScene(scene);
8586
stage.show();
8687

87-
// create a map with a basemap
88-
ArcGISMap map = new ArcGISMap(Basemap.createStreetsVector());
88+
// authentication with an API key or named user is required to access basemaps and other location services
89+
String yourAPIKey = System.getProperty("apiKey");
90+
ArcGISRuntimeEnvironment.setApiKey(yourAPIKey);
8991

90-
// create and add a map image layer to the map
92+
// create a map with the streets basemap style
93+
ArcGISMap map = new ArcGISMap(BasemapStyle.ARCGIS_STREETS);
94+
95+
// create and add a map image layer to the map's operational layers
9196
// the map image layer contains a feature table with related spatial and non-spatial comment features
9297
ArcGISMapImageLayer imageLayer = new ArcGISMapImageLayer(
9398
"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/MapServer");
@@ -155,7 +160,7 @@ protected void updateItem(Feature item, boolean empty) {
155160
}
156161
});
157162

158-
// add the mapview and controls to the stack pane
163+
// add the map view and list view to the stack pane
159164
stackPane.getChildren().addAll(mapView, commentsListView);
160165
StackPane.setAlignment(commentsListView, Pos.TOP_LEFT);
161166
StackPane.setMargin(commentsListView, new Insets(10, 0, 0, 10));

image_layers/query-map-image-sublayer/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
group = 'com.esri.samples'
77

88
ext {
9-
arcgisVersion = '100.9.0'
9+
arcgisVersion = '100.10.0-2992'
1010
}
1111

1212
javafx {

image_layers/query-map-image-sublayer/src/main/java/com/esri/samples/query_map_image_sublayer/QueryMapImageSublayerSample.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,17 @@
3232
import javafx.scene.paint.Paint;
3333
import javafx.stage.Stage;
3434

35+
import com.esri.arcgisruntime.ArcGISRuntimeEnvironment;
3536
import com.esri.arcgisruntime.concurrent.ListenableFuture;
3637
import com.esri.arcgisruntime.data.Feature;
3738
import com.esri.arcgisruntime.data.FeatureQueryResult;
3839
import com.esri.arcgisruntime.data.QueryParameters;
3940
import com.esri.arcgisruntime.data.ServiceFeatureTable;
40-
import com.esri.arcgisruntime.geometry.Point;
41-
import com.esri.arcgisruntime.geometry.SpatialReferences;
4241
import com.esri.arcgisruntime.layers.ArcGISMapImageLayer;
4342
import com.esri.arcgisruntime.layers.ArcGISMapImageSublayer;
4443
import com.esri.arcgisruntime.loadable.LoadStatus;
4544
import com.esri.arcgisruntime.mapping.ArcGISMap;
46-
import com.esri.arcgisruntime.mapping.Basemap;
45+
import com.esri.arcgisruntime.mapping.BasemapStyle;
4746
import com.esri.arcgisruntime.mapping.Viewpoint;
4847
import com.esri.arcgisruntime.mapping.view.Graphic;
4948
import com.esri.arcgisruntime.mapping.view.GraphicsOverlay;
@@ -72,20 +71,24 @@ public void start(Stage stage) {
7271
stage.setScene(scene);
7372
stage.show();
7473

75-
// create a map with a basemap and set its initial viewpoint
76-
ArcGISMap map = new ArcGISMap(Basemap.createStreetsVector());
77-
Point initialLocation = new Point(-12716000.00, 4170400.00, SpatialReferences.getWebMercator());
78-
Viewpoint viewpoint = new Viewpoint(initialLocation, 6000000);
79-
map.setInitialViewpoint(viewpoint);
74+
// authentication with an API key or named user is required to access basemaps and other location services
75+
String yourAPIKey = System.getProperty("apiKey");
76+
ArcGISRuntimeEnvironment.setApiKey(yourAPIKey);
8077

81-
// create and add a map image layer to the map
78+
// create a map with the streets basemap style
79+
ArcGISMap map = new ArcGISMap(BasemapStyle.ARCGIS_STREETS);
80+
81+
// create and add a map image layer to the map's operational layers
8282
ArcGISMapImageLayer imageLayer = new ArcGISMapImageLayer("https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer");
8383
map.getOperationalLayers().add(imageLayer);
8484

8585
// create a map view and set the map to it
8686
mapView = new MapView();
8787
mapView.setMap(map);
8888

89+
// set a viewpoint on the map view
90+
mapView.setViewpoint(new Viewpoint(36.75056, -115.44154, 6000000));
91+
8992
// create a graphics overlay to show the results in
9093
GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
9194
mapView.getGraphicsOverlays().add(graphicsOverlay);

0 commit comments

Comments
 (0)