You can create a web map using ArcGIS Online or Portal for ArcGIS, then display it in a Java map application's JMap, as described in Build a web mapping app. This topic describes how the ArcGIS Runtime SDK for Java handles certain features of web maps.
Supported web map layers
When you display in a JMap a web map created using ArcGIS Online or Portal for ArcGIS, the web map's layers are converted to layer types from ArcGIS Runtime SDK for Java, based on what layers are specified in the web map's JSON. For more information on the JSON structure of web maps, see Understanding the map format. The list that follows associates the layers you can add to an ArcGIS Online web map with the layer types in the ArcGIS Runtime Java API:
- ArcGIS map service layer:
- With tile cache—Creates an ArcGISTiledMapServiceLayer
- Without tile cache—Creates an ArcGISDynamicMapServiceLayer
- ArcGIS feature service layer—Creates an ArcGISFeatureLayer
- ArcGIS image service layer—Creates an ArcGISImageServiceLayer
- Bing Maps basemaps—Creates a BingMapsLayer
For your web map's Bing Maps basemap to display in a Java application, set your Bing Maps key for the map by using the loadWebMap overload which takes a Bing key: jMap.loadWebMap(webMap, "yourBingKey");.
- OpenStreetMap basemap—Creates an OpenStreetMapLayer
- Layer from KML via URL—Creates a KMLLayer
The URL of the KML or KMZ (compressed KML) file must be publicly accessible for the layer to display in a Java application. If you added a file to your ArcGIS Online account, the file/resource must be public.
- Layer from CSV (by referencing a URL)—Creates a CSVLayer
- GPX—Creates an ArcGISFeatureLayer feature collection
Disabling editing on feature layers
When you add a layer from an editable feature server to an ArcGIS web map, you have the option to disable editing for this layer. You can do so with the ArcGIS Online web map editor by clicking the layer and selecting Disable Editing from the list of options (or conversely, if editing is disabled, Enable Editing will show as the option). If you save the web map with the editing disabled on a feature layer and open this web map in a Java application, edits on this layer will not be permitted in the Java application. The reverse is not true; you cannot enable editing via the ArcGIS Online web map editor on a layer from a feature service that is not editable.
You cannot edit layers created manually within ArcGIS Online via Add Map Notes. The ArcGIS Runtime Java API turns these layers into feature collections. For feature collections, you cannot apply edits back to a service, therefore editing is disabled.
Setting a minimum and maximum scale on layers
When you create or edit a web map on ArcGIS Online, you can set a minimum and maximum scale on any layer. This is done by clicking the layer in the table of contents and, from the resulting list of options, choosing Set Visibility Range. If you've set a minimum scale on a layer in a web map, the layer will no longer display in your JMap when you are zoomed out past this scale. If you've set a maximum scale on a layer, the layer will no longer display if you are zoomed in beyond this scale.