How do I get a web map server to display on the map?

795
2
07-17-2017 05:37 AM
RajHans
New Contributor

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);
  }

}

0 Kudos
2 Replies
nita14
by
Occasional Contributor III

Dear Raj,

Please check those first:

1) Are you sure that "http://192.168.201.97/mapcache/wmts" is the service endpoint?

2) Does WKID and Tiling scheme align with ArcGIS Online?

3) What does say network inspector? Is there any request to endpoint?

Regards,

Adam

0 Kudos
RajHans
New Contributor

Hi Adam,

1) Yes that is the end point - this map server works with other GIS libraries.

2) The map server is OGC compliant. Is ArcGIS? (Or do you mean something else here?)

3) The endpoint gets the requests for sure (proven with other libraries consistently)

Raj

0 Kudos