I am having difficulty getting a web map server to display on the map (arcgis-runtime-sdk-java-100.1.0-1744). My code is below. This same map server works fine with other mapping tools. I've also tried a couple of other servers as well but nothing ever displays.
Thanks,
Raj
import com.esri.arcgisruntime.layers.WmtsLayer;
import com.esri.arcgisruntime.loadable.LoadStatus;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import com.esri.arcgisruntime.mapping.ArcGISMap;
import com.esri.arcgisruntime.mapping.view.MapView;
public class DisplayMapSample extends Application {
private MapView mapView;
@Override
public void start(Stage stage) throws Exception {
#
try {
// create stack pane and application scene
StackPane stackPane = new StackPane();
Scene scene = new Scene(stackPane);
// set title, size, and add scene to stage
stage.setTitle("Display Map Sample");
stage.setWidth(800);
stage.setHeight(700);
stage.setScene(scene);
stage.show();
ArcGISMap map = new ArcGISMap();//Basemap.createImagery());
WmtsLayer wmtsLayer = new WmtsLayer("http://192.168.201.97/mapcache/wmts", "wmts");
wmtsLayer.addDoneLoadingListener(new Runnable() {
public void run() {
if (wmtsLayer.getLoadStatus() == LoadStatus.LOADED) {
// work with WMTS layer here
}
}
});
map.getOperationalLayers().add(wmtsLayer);
// set the map to be displayed in this view
mapView = new MapView();
mapView.setMap(map);
// add the map view to stack pane
stackPane.getChildren().addAll(mapView);
} catch (Exception e) {
// on any error, display the stack trace.
e.printStackTrace();
}
}
/**
* Stops and releases all resources used in application.
*/
@Override
public void stop() throws Exception {
if (mapView != null) {
mapView.dispose();
}
}
#
/**
* Opens and runs application.
*
* @param args arguments passed to this application
*/
public static void main(String[] args) {
Application.launch(args);
}
}