Skip to content

Commit aea5574

Browse files
authored
New Basemaps: Network Analysis and OGC Categories (#607)
* Closest facility * Closest facility static * Find service areas for multiple facilities * Routing around barriers * Service area task * Browse wfs layers * Display wfs layer sample * OpenStreetMap layer * WFS XML query * WMS layer URL * OpenStreetMap Layer - set viewpoint on mapview * Find route * OSM - update readme and comment * update build.gradle - versions * Tidy up comment and scale consistencies * comment typo fix
1 parent aac0960 commit aea5574

File tree

23 files changed

+154
-78
lines changed

23 files changed

+154
-78
lines changed

network_analysis/closest-facility-static/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 {

network_analysis/closest-facility-static/src/main/java/com/esri/samples/closest_facility_static/ClosestFacilityStaticSample.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import javafx.scene.layout.StackPane;
3232
import javafx.stage.Stage;
3333

34+
import com.esri.arcgisruntime.ArcGISRuntimeEnvironment;
3435
import com.esri.arcgisruntime.concurrent.ListenableFuture;
3536
import com.esri.arcgisruntime.data.Feature;
3637
import com.esri.arcgisruntime.data.FeatureQueryResult;
@@ -43,7 +44,7 @@
4344
import com.esri.arcgisruntime.layers.FeatureLayer;
4445
import com.esri.arcgisruntime.loadable.LoadStatus;
4546
import com.esri.arcgisruntime.mapping.ArcGISMap;
46-
import com.esri.arcgisruntime.mapping.Basemap;
47+
import com.esri.arcgisruntime.mapping.BasemapStyle;
4748
import com.esri.arcgisruntime.mapping.view.Graphic;
4849
import com.esri.arcgisruntime.mapping.view.GraphicsOverlay;
4950
import com.esri.arcgisruntime.mapping.view.MapView;
@@ -77,6 +78,10 @@ public void start(Stage stage) throws Exception {
7778
stage.setScene(scene);
7879
stage.show();
7980

81+
// authentication with an API key or named user is required to access basemaps and other location services
82+
String yourAPIKey = System.getProperty("apiKey");
83+
ArcGISRuntimeEnvironment.setApiKey(yourAPIKey);
84+
8085
// create buttons
8186
Button solveRoutesButton = new Button("Solve Routes");
8287
solveRoutesButton.setMaxWidth(150);
@@ -86,10 +91,10 @@ public void start(Stage stage) throws Exception {
8691
ProgressIndicator progressIndicator = new ProgressIndicator();
8792
progressIndicator.setVisible(true);
8893

89-
// create a ArcGISMap with a Basemap instance with an Imagery base layer
90-
ArcGISMap map = new ArcGISMap(Basemap.createStreetsWithReliefVector());
94+
// create a map with the streets relief basemap style
95+
ArcGISMap map = new ArcGISMap(BasemapStyle.ARCGIS_STREETS_RELIEF);
9196

92-
// set the map to be displayed in this view
97+
// create a map view and set the map to it
9398
mapView = new MapView();
9499
mapView.setMap(map);
95100

network_analysis/closest-facility/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 {

network_analysis/closest-facility/src/main/java/com/esri/samples/closest_facility/ClosestFacilitySample.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@
3131
import javafx.scene.layout.StackPane;
3232
import javafx.stage.Stage;
3333

34+
import com.esri.arcgisruntime.ArcGISRuntimeEnvironment;
3435
import com.esri.arcgisruntime.concurrent.ListenableFuture;
3536
import com.esri.arcgisruntime.geometry.Point;
3637
import com.esri.arcgisruntime.geometry.SpatialReference;
3738
import com.esri.arcgisruntime.geometry.SpatialReferences;
3839
import com.esri.arcgisruntime.loadable.LoadStatus;
3940
import com.esri.arcgisruntime.mapping.ArcGISMap;
40-
import com.esri.arcgisruntime.mapping.Basemap;
41+
import com.esri.arcgisruntime.mapping.BasemapStyle;
4142
import com.esri.arcgisruntime.mapping.Viewpoint;
4243
import com.esri.arcgisruntime.mapping.view.Graphic;
4344
import com.esri.arcgisruntime.mapping.view.GraphicsOverlay;
@@ -86,14 +87,21 @@ public void start(Stage stage) {
8687

8788
try {
8889

89-
// create a map with streets basemap and add to view
90-
ArcGISMap map = new ArcGISMap(Basemap.createStreets());
90+
// authentication with an API key or named user is required to access basemaps and other location services
91+
String yourAPIKey = System.getProperty("apiKey");
92+
ArcGISRuntimeEnvironment.setApiKey(yourAPIKey);
93+
94+
// create a map with the streets basemap style
95+
ArcGISMap map = new ArcGISMap(BasemapStyle.ARCGIS_STREETS);
96+
97+
// create a map view and set the map to it
9198
mapView = new MapView();
9299
mapView.setMap(map);
93-
// add the mapview to stack pane
100+
101+
// add the map view to stack pane
94102
stackPane.getChildren().addAll(mapView);
95103

96-
// set view to be over San Diego
104+
// set a viewpoint on the map view to be over San Diego
97105
mapView.setViewpoint(new Viewpoint(32.727, -117.1750, 40000));
98106

99107
facilityGraphicsOverlay = new GraphicsOverlay();

network_analysis/find-route/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 {

network_analysis/find-route/src/main/java/com/esri/samples/find_route/FindRouteSample.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@
3535
import javafx.scene.paint.Paint;
3636
import javafx.stage.Stage;
3737

38+
import com.esri.arcgisruntime.ArcGISRuntimeEnvironment;
3839
import com.esri.arcgisruntime.geometry.Envelope;
3940
import com.esri.arcgisruntime.geometry.Geometry;
4041
import com.esri.arcgisruntime.geometry.Point;
4142
import com.esri.arcgisruntime.geometry.SpatialReference;
4243
import com.esri.arcgisruntime.loadable.LoadStatus;
4344
import com.esri.arcgisruntime.mapping.ArcGISMap;
44-
import com.esri.arcgisruntime.mapping.Basemap;
45+
import com.esri.arcgisruntime.mapping.BasemapStyle;
4546
import com.esri.arcgisruntime.mapping.view.DrawStatus;
4647
import com.esri.arcgisruntime.mapping.view.Graphic;
4748
import com.esri.arcgisruntime.mapping.view.GraphicsOverlay;
@@ -92,6 +93,10 @@ public void start(Stage stage) {
9293
stage.setScene(scene);
9394
stage.show();
9495

96+
// authentication with an API key or named user is required to access basemaps and other location services
97+
String yourAPIKey = System.getProperty("apiKey");
98+
ArcGISRuntimeEnvironment.setApiKey(yourAPIKey);
99+
95100
// create a control panel
96101
VBox controlsVBox = new VBox(6);
97102
controlsVBox.setBackground(new Background(new BackgroundFill(Paint.valueOf("rgba(0,0,0,0.3)"), CornerRadii.EMPTY,
@@ -148,10 +153,10 @@ public void start(Stage stage) {
148153
// add buttons and direction list and label to the control panel
149154
controlsVBox.getChildren().addAll(directionsLabel, directionsList, findButton, resetButton);
150155

151-
// create a ArcGISMap with a streets basemap
152-
ArcGISMap map = new ArcGISMap(Basemap.createStreets());
156+
// create a map with the streets basemap style
157+
ArcGISMap map = new ArcGISMap(BasemapStyle.ARCGIS_STREETS);
153158

154-
// set the ArcGISMap to be displayed in this view
159+
// create a map view and set the map to it
155160
mapView = new MapView();
156161
mapView.setMap(map);
157162

network_analysis/find-service-areas-for-multiple-facilities/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 {

network_analysis/find-service-areas-for-multiple-facilities/src/main/java/com/esri/samples/find_service_areas_for_multiple_facilities/FindServiceAreasForMultipleFacilitiesSample.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@
3131
import javafx.scene.layout.StackPane;
3232
import javafx.stage.Stage;
3333

34+
import com.esri.arcgisruntime.ArcGISRuntimeEnvironment;
3435
import com.esri.arcgisruntime.concurrent.ListenableFuture;
3536
import com.esri.arcgisruntime.data.ArcGISFeatureTable;
3637
import com.esri.arcgisruntime.data.QueryParameters;
3738
import com.esri.arcgisruntime.data.ServiceFeatureTable;
3839
import com.esri.arcgisruntime.layers.FeatureLayer;
3940
import com.esri.arcgisruntime.loadable.LoadStatus;
4041
import com.esri.arcgisruntime.mapping.ArcGISMap;
41-
import com.esri.arcgisruntime.mapping.Basemap;
42+
import com.esri.arcgisruntime.mapping.BasemapStyle;
4243
import com.esri.arcgisruntime.mapping.view.DrawStatus;
4344
import com.esri.arcgisruntime.mapping.view.DrawStatusChangedEvent;
4445
import com.esri.arcgisruntime.mapping.view.DrawStatusChangedListener;
@@ -73,6 +74,10 @@ public void start(Stage stage) {
7374
stage.setScene(scene);
7475
stage.show();
7576

77+
// authentication with an API key or named user is required to access basemaps and other location services
78+
String yourAPIKey = System.getProperty("apiKey");
79+
ArcGISRuntimeEnvironment.setApiKey(yourAPIKey);
80+
7681
// create button
7782
Button findServiceAreasButton = new Button("Find Service Areas");
7883
findServiceAreasButton.setMaxWidth(150);
@@ -82,10 +87,10 @@ public void start(Stage stage) {
8287
ProgressIndicator progressIndicator = new ProgressIndicator();
8388
progressIndicator.setVisible(false);
8489

85-
// create an ArcGISMap with a streets basemap
86-
ArcGISMap map = new ArcGISMap(Basemap.createLightGrayCanvas());
90+
// create a map with the light gray basemap style
91+
ArcGISMap map = new ArcGISMap(BasemapStyle.ARCGIS_LIGHT_GRAY);
8792

88-
// set the ArcGISMap to be displayed in the map view
93+
// create a map view and set the map to it
8994
mapView = new MapView();
9095
mapView.setMap(map);
9196

@@ -112,7 +117,7 @@ public void start(Stage stage) {
112117
// set the renderer of the facilities feature layer to use the facilities symbol
113118
facilitiesFeatureLayer.setRenderer(new SimpleRenderer(facilitySymbol));
114119

115-
// add the facilities feature layer to the map
120+
// add the facilities feature layer to the map's operational layers
116121
map.getOperationalLayers().add(facilitiesFeatureLayer);
117122

118123
// wait for the facilities feature layer to load

network_analysis/routing-around-barriers/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 {

network_analysis/routing-around-barriers/src/main/java/com/esri/samples/routing_around_barriers/RoutingAroundBarriersController.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,15 @@
3232
import javafx.scene.input.MouseButton;
3333
import javafx.scene.input.MouseEvent;
3434

35+
import com.esri.arcgisruntime.ArcGISRuntimeEnvironment;
3536
import com.esri.arcgisruntime.concurrent.ListenableFuture;
3637
import com.esri.arcgisruntime.geometry.Geometry;
3738
import com.esri.arcgisruntime.geometry.GeometryEngine;
3839
import com.esri.arcgisruntime.geometry.Point;
3940
import com.esri.arcgisruntime.geometry.Polygon;
4041
import com.esri.arcgisruntime.loadable.LoadStatus;
4142
import com.esri.arcgisruntime.mapping.ArcGISMap;
42-
import com.esri.arcgisruntime.mapping.Basemap;
43+
import com.esri.arcgisruntime.mapping.BasemapStyle;
4344
import com.esri.arcgisruntime.mapping.Viewpoint;
4445
import com.esri.arcgisruntime.mapping.view.Graphic;
4546
import com.esri.arcgisruntime.mapping.view.GraphicsOverlay;
@@ -83,9 +84,15 @@ public class RoutingAroundBarriersController {
8384

8485
@FXML
8586
public void initialize() {
86-
// add a map with the streets basemap to the map view, centered on San Diego
87-
ArcGISMap map = new ArcGISMap(Basemap.createStreets());
87+
// authentication with an API key or named user is required to access basemaps and other location services
88+
String yourAPIKey = System.getProperty("apiKey");
89+
ArcGISRuntimeEnvironment.setApiKey(yourAPIKey);
90+
91+
// create a map with the streets basemap style and set it to the map view
92+
ArcGISMap map = new ArcGISMap(BasemapStyle.ARCGIS_STREETS);
8893
mapView.setMap(map);
94+
95+
// set a viewpoint on the map view
8996
mapView.setViewpoint(new Viewpoint(32.727, -117.1750, 40000));
9097

9198
// add the graphics overlays to the map view

0 commit comments

Comments
 (0)