Class GeoModel

java.lang.Object
com.esri.arcgisruntime.mapping.GeoModel
All Implemented Interfaces:
Loadable
Direct Known Subclasses:
ArcGISMap, ArcGISScene

public abstract class GeoModel extends Object implements Loadable
A base class for ArcGISMap and ArcGISScene that contains layers and properties and can be displayed in a GeoView.

This base class represents the model in a model-view-controller (MVC) architecture, while the GeoView represents the view. To display a map or scene to the user, pass GeoModel to its appropriate GeoView, as follows:

GeoModel has many properties that are common to both maps and scenes. For example:

  • Each map or scene typically has a getBasemap() to help orient the users.
  • The getOperationalLayers() collection gives you access to the vector data (points, line, polygons), raster data, and attribute information provided by the ArcGISMap or ArcGISScene.
  • The getSpatialReference() determines how spatial data relates to real-world space.
Since:
100.12.0
  • Property Details

  • Method Details

    • getBasemap

      public Basemap getBasemap()
      Gets the basemap for this map or scene.

      A basemap provides a background of geographical context for the content you display in a map or scene. It is an optional set of non-editable layers such as aerial imagery, roads, or landmarks, that help orient the user of the map or scene.

      A basemap is composed of a collection of base layers (Basemap.getBaseLayers()) and reference layers (Basemap.getReferenceLayers()). Base layers are displayed at the bottom of a map or scene, and reference layers are displayed at the top, with the getOperationalLayers() between them.

      You can use ready-to-use basemaps, style your own basemaps with the ArcGIS Vector Tile Style Editor, or create and publish your own with ArcGIS Pro.

      Returns:
      optional layers in a map or scene that show background information — roads, landmarks, and so on — to help orient the user of the map or scene. Typically image tile or vector tile layer types. Returns null if none.
      Since:
      100.0.0
    • setBasemap

      public void setBasemap(Basemap basemap)
      Sets the basemap for this map or scene.

      A basemap provides a background of geographical context for the content you display in a map or scene. It is an optional set of non-editable layers such as aerial imagery, roads, or landmarks, that help orient the user of the map or scene.

      A basemap is composed of a collection of base layers (Basemap.getBaseLayers()) and reference layers (Basemap.getReferenceLayers()). Base layers are displayed at the bottom of a map or scene, and reference layers are displayed at the top, with the getOperationalLayers() between them.

      You can use ready-to-use basemaps, style your own basemaps with the ArcGIS Vector Tile Style Editor, or create and publish your own with ArcGIS Pro.

      Parameters:
      basemap - optional layers in a map or scene that show background information — roads, landmarks, and so on — to help orient the user of the map or scene. Typically image tile or vector tile layer types.
      Since:
      100.0.0
      See Also:
    • getBookmarks

      public BookmarkList getBookmarks()
      Gets the collection of bookmarks defined for this map or scene.

      Bookmarks allow users to quickly navigate to a particular area of interest in a map or scene.

      Returns:
      the collection of bookmarks defined for this map or scene
      Since:
      100.0.0
    • getFloorDefinition

      public GeoModelFloorDefinition getFloorDefinition()
      Gets the floor definition that defines the properties that allow a map or a scene to be floor-aware.

      Floor-aware maps and scenes contain data representing floor plan and indoor features. The data displayed by floor-aware maps and scenes can be filtered based on floor levels using the FloorManager. This property is null for maps or scenes that are not floor-aware.

      Returns:
      the floor definition that defines the properties that allow a map or a scene to be floor-aware, or null if none
      Since:
      100.12.0
      See Also:
    • setFloorDefinition

      public void setFloorDefinition(GeoModelFloorDefinition floorDefinition)
      Sets the floor definition that defines the properties that allow a map or a scene to be floor-aware.

      Floor-aware maps and scenes contain data representing floor plan and indoor features. The data displayed by floor-aware maps and scenes can be filtered based on floor levels using the FloorManager. This property is null for maps or scenes that are not floor-aware.

      Upon setting the floor definition, the current getFloorManager() instance is invalidated. You should get a new unloaded FloorManager instance to perform floor filtering.

      Parameters:
      floorDefinition - defines the properties that allow a map or a scene to be floor-aware
      Since:
      100.12.0
    • getFloorManager

      public FloorManager getFloorManager()
      Gets the FloorManager, which manages the data displayed for a floor-aware map or scene, allowing filtering based on floor levels.

      A FloorManager must be loaded before you can access its site, facility, and level properties, and perform floor filtering.

      When a map's floor manager is loaded, floor-aware layers display only data associated with the ground floor by default. When a scene's floor manager is loaded, floor-aware layers display data from all floors by default. You can filter the data displayed by floor-aware layers by toggling the FloorLevel.isVisible() property of levels in the floor manager.

      Returns:
      the FloorManager instance for working with floor filtering, or null if none
      Since:
      100.12.0
    • getGeotriggersInfo

      public GeotriggersInfo getGeotriggersInfo()
      Gets the information about the set of Geotrigger objects defined for the map or scene.

      You must load the GeotriggersInfo to populate the collection with any geotriggers defined by the author of the map or scene. If no geotriggers are defined this list will remain empty.

      Use a GeotriggerMonitor to check each of the conditions defined in GeotriggersInfo.getGeotriggers().

      When you save a map, any Geotrigger objects that reference local data (for example, a GraphicsOverlayFenceParameters) will be omitted.

      Returns:
      an object that presents information on the set of Geotrigger objects defined for the map or scene
      Since:
      100.14.0
    • getInitialViewpoint

      public Viewpoint getInitialViewpoint()
      Gets the initial viewpoint, when the map or scene is first displayed.

      The initial viewpoint value is available when the map or scene is loaded. If you want to change the initial viewpoint, you can do this before you add the map or scene to a GeoView. At this point, the GeoView's viewpoint is set to this initial viewpoint. Any subsequent changes to the getInitialViewpoint() are ignored.

      If you want to change the viewpoint of a displayed map or scene, use methods such as:

      Returns:
      the initial viewpoint for the map or scene, or null if none
      Since:
      100.0.0
    • setInitialViewpoint

      public void setInitialViewpoint(Viewpoint initialViewpoint)
      Sets the initial viewpoint, when the map or scene is first displayed.

      The initial viewpoint value is available when the map or scene is loaded. If you want to change the initial viewpoint, you can do this before you add the map or scene to a GeoView. At this point, the GeoView's viewpoint is set to this initial viewpoint. Any subsequent changes to the getInitialViewpoint() are ignored.

      If you want to change the viewpoint of a displayed map or scene, use methods such as:

      Parameters:
      initialViewpoint - the initial viewpoint for the map or scene
      Throws:
      IllegalArgumentException - if initialViewpoint is null
      Since:
      100.0.0
    • getItem

      public Item getItem()
      Gets the ArcGIS item associated with this map or scene.

      This can be a PortalItem (for web maps and web scenes loaded from a portal or saved to a portal), or a LocalItem (for maps in a map package or scenes in a scene package), or null if no Item is associated with this map or scene.

      Returns:
      the item for the map or scene, or null if none
      Since:
      100.3.0
    • setItem

      public void setItem(Item item)
      Sets the ArcGIS item associated with this map or scene.

      This can be a PortalItem (for web maps and web scenes loaded from a portal or saved to a portal), or a LocalItem (for maps in a map package or scenes in a scene package), or null if no Item is associated with this map or scene.

      Parameters:
      item - the item for the map or scene
      Since:
      100.3.0
    • getLoadSettings

      public LoadSettings getLoadSettings()
      Gets the properties that control the default loading and rendering behavior of feature layers in this map or scene.

      For example, you can specify which tiling mode should be used when feature layers are added, or specify whether feature tables should use advanced symbology.

      Returns:
      the current default behaviors (preferences) that control the rendering behaviors for maps and scenes as they load
      Since:
      100.2.0
      See Also:
    • setLoadSettings

      public void setLoadSettings(LoadSettings loadSettings)
      Sets the properties that control the default loading and rendering behavior of feature layers in this map or scene.

      For example, you can specify which tiling mode should be used when feature layers are added, or specify whether feature tables should use advanced symbology.

      Parameters:
      loadSettings - default behaviors (preferences) that control the rendering behaviors for maps and scenes as they load
      Throws:
      IllegalArgumentException - if loadSettings is null
      Since:
      100.2.0
      See Also:
    • getOperationalLayers

      public LayerList getOperationalLayers()
      Gets a collection of layers that can access geographic data from a file or a service.

      The operational layers collection is used to display geographic data layers on top of a basemap layer in an ArcGISMap or ArcGISScene. For example, you can display a fleet of vehicles being tracked on a map or display a point cloud layer of a tree canopy in a scene.

      This collection of layers is unique to the map or scene, it cannot be used by another GeoModel. You can add and remove layers from the map or scene by adding and removing them from this collection. Ensure that the map has finished loading, otherwise you will replace the map's original operational layers with the newly added layers.

      The first layer in the getOperationalLayers() collection is drawn first (on the bottom) above the basemap layer. Each subsequent layer is drawn on top. Typically, imagery or tile layers are added to the collection first, and then polygon, line, and point layers last. When you pass the GeoModel to the GeoView it combines these layers to create the final display for the user.

      See Data Layers for more information about working with operational layers.

      Returns:
      a collection of layers that can access geographic data from a file or a service
      Since:
      100.0.0
      See Also:
    • getSpatialReference

      public SpatialReference getSpatialReference()
      Gets the spatial reference for this map or scene.

      SpatialReference specifies how geometry coordinates relate to real-world space. It ensures that you can accurately view, query, and analyze the layers of a map or scene.

      The spatial reference value is null until the ArcGISMap or ArcGISScene is loaded. You can set this value explicitly using the ArcGISMap(SpatialReference) or ArcGISScene(ArcGISScene.SceneViewTilingScheme) constructors.

      Returns:
      a well-known ID (WKID) integer value or a text string definition referred to as a well-known text (WKT) representation that identifies how a geometry's coordinates relate to real-world space. Returns null if none.
      Since:
      100.0.0
    • getTables

      public List<FeatureTable> getTables()
      Gets a collection of feature tables in the map or scene. Unlike getOperationalLayers(), tables are not displayed by the GeoView.

      The collection of feature tables is specific to the map or scene. You can add and remove tables by adding or removing them from the collection.

      By default, the tables are not loaded. You can load them explicitly (FeatureTable.loadAsync()) or load them by calling methods such as FeatureTable.queryFeaturesAsync(QueryParameters).

      Returns:
      a collection of feature tables in the map or scene
      Since:
      100.3.0
    • getTransportationNetworks

      public List<TransportationNetworkDataset> getTransportationNetworks()
      Gets an unmodifiable list of transportation network datasets defined for the map or scene.

      Map and scene authors can use ArcGIS Pro to create mobile map or scene packages that include transportation networks. If the map or scene is created from one of these packages, this collection will be populated with a read-only collection of TransportationNetworkDataset objects.

      A TransportationNetworkDataset from this collection can be used to construct one of the network analysis tasks (such as RouteTask, ServiceAreaTask, and ClosestFacilityTask).

      Returns:
      a list of transportation network datasets defined for the map or scene
      Since:
      100.7.0
      See Also:
    • getVersion

      public String getVersion()
      Gets the version of the ArcGISMap or ArcGISScene when it is loaded. The version of a newly created ArcGISMap or ArcGISScene is empty.

      When you load an existing map or scene, the version value is the version that it was created at, according to the ESRI web map specification or ESRI web scene specification, respectively.

      You can make changes to a map (associated with a PortalItem) and save it back to the web map it originated from. Alternatively, you can save a map as a new web map on a specified Portal with a given title and folder. In these cases, the version of the saved map will be the version of the ESRI web map specification supported by this API. You cannot save changes to maps in mobile map packages.

      Saving changes to scenes is not currently supported.

      Returns:
      the version for the map or scene
      Since:
      100.3.0
    • getLoadError

      public ArcGISRuntimeException getLoadError()
      Gets the value of the loadError property.
      Specified by:
      getLoadError in interface Loadable
      Property description:
      Returns:
      the value of the loadError property
      See Also:
    • getLoadStatus

      public LoadStatus getLoadStatus()
      Gets the value of the loadStatus property.
      Specified by:
      getLoadStatus in interface Loadable
      Property description:
      Returns:
      the value of the loadStatus property
      See Also:
    • cancelLoad

      public void cancelLoad()
      Description copied from interface: Loadable
      Cancels loading metadata for the object.

      Cancels loading the metadata if the object is loading, and always invokes the done loading listener.

      A load operation that is in progress (LoadStatus.LOADING state) can be cancelled by calling this method and the resource will transition from LoadStatus.LOADING to LoadStatus.FAILED_TO_LOAD state. If the load operation was successfully cancelled, a CancellationException will be returned from Loadable.getLoadError().

      Cancellation should be used carefully because all enqueued done loading listeners for that resource instance will get invoked with an error stating that the operation was cancelled. Thus, one component in the application can cancel the load operation initiated by other components.

      This method does nothing if the resource is not in LoadStatus.LOADING state.

      Specified by:
      cancelLoad in interface Loadable
    • loadAsync

      public void loadAsync()
      Description copied from interface: Loadable
      Loads the metadata of the loadable resource asynchronously.

      The load status changes from LoadStatus.NOT_LOADED to LoadStatus.LOADING. A listener can be added via Loadable.addDoneLoadingListener(java.lang.Runnable) that is invoked upon completion of the asynchronous load operation.

      If the load operation completes successfully, the load status will be LoadStatus.LOADED, which means the resource has loaded its metadata.

      If the load operation failed, the load status will be LoadStatus.FAILED_TO_LOAD and the error can be retrieved by calling Loadable.getLoadError().

      This method can be called concurrently and repeatedly, but only one attempt is ever made to perform the load operation. If a load operation is already in progress (LoadStatus.LOADING state) when loadAsync is called, it simply piggy-backs on the outstanding operation and the done loading listener added to the loadable resource is enqueued to be invoked when that operation completes. If the operation has already completed (LoadStatus.LOADED or LoadStatus.FAILED_TO_LOAD state) when loadAsync is called, the done loading listener is immediately invoked when added to the loadable resource.

      If a loadable resource has failed to load, calling loadAsync on it subsequently will not change its state. The done loading listener will be invoked immediately when added to the loadable resource. In order to retry loading the resource, Loadable.retryLoadAsync() needs to be used.

      A load operation that is in progress (LoadStatus.LOADING state) can be cancelled by calling Loadable.cancelLoad().

      Specified by:
      loadAsync in interface Loadable
    • retryLoadAsync

      public void retryLoadAsync()
      Description copied from interface: Loadable
      Loads or retries loading metadata for the object asynchronously.

      Will retry loading the metadata if the object's load status is LoadStatus.FAILED_TO_LOAD. Will load the object if it is not loaded. Will not retry to load the object if the object is loaded.

      For more details on the load process see Loadable.loadAsync().

      Specified by:
      retryLoadAsync in interface Loadable
    • addDoneLoadingListener

      public void addDoneLoadingListener(Runnable runner)
      Description copied from interface: Loadable
      Adds a listener to the loadable resource that is invoked when loading has completed.

      The listener may be added at any point, whether the loadable resource has already completed loading or not.

      • For resources that are not loaded when the listener is added (LoadStatus is NOT_LOADED or LOADING): When the resource completes loading, the listener will be invoked on the UI thread if it is added from the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.
      • For resources that are already loaded when the listener is added (LoadStatus is LOADED or FAILED_TO_LOAD): The listener will be called immediately, on the current thread.

      Alternatively, to be notified when there is any change in the load status, add a listener to the Loadable.loadStatusProperty() instead.

      Specified by:
      addDoneLoadingListener in interface Loadable
      Parameters:
      runner - a Runnable that is invoked upon completion of the load operation
    • removeDoneLoadingListener

      public boolean removeDoneLoadingListener(Runnable runner)
      Description copied from interface: Loadable
      Removes a done loading listener from the loadable resource.
      Specified by:
      removeDoneLoadingListener in interface Loadable
      Parameters:
      runner - the listener to be removed
      Returns:
      true if the listener was removed, otherwise false
    • addLoadStatusChangedListener

      public void addLoadStatusChangedListener(LoadStatusChangedListener listener)
      Description copied from interface: Loadable
      Adds a LoadStatusChangedListener to the loadable resource that is invoked whenever the load status changes.

      Adding this listener on the UI thread will cause it to be invoked on the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.

      The listener will not be called if added to a loadable resource that has already completed loading. To be notified when a loadable resource has completed loading, including if the resource is already loaded when the listener is added, use the Loadable.addDoneLoadingListener(Runnable) method.

      Specified by:
      addLoadStatusChangedListener in interface Loadable
      Parameters:
      listener - the LoadStatusChangedListener to be added
    • removeLoadStatusChangedListener

      public boolean removeLoadStatusChangedListener(LoadStatusChangedListener listener)
      Description copied from interface: Loadable
      Removes a LoadStatusChangedListener from the loadable resource.
      Specified by:
      removeLoadStatusChangedListener in interface Loadable
      Parameters:
      listener - the LoadStatusChangedListener to be removed
      Returns:
      true if the listener was removed, otherwise false
    • loadStatusProperty

      public ReadOnlyObjectProperty<LoadStatus> loadStatusProperty()
      Description copied from interface: Loadable
      The load status.
      Specified by:
      loadStatusProperty in interface Loadable
      Returns:
      the loadStatus property
      See Also:
    • loadErrorProperty

      public ReadOnlyObjectProperty<ArcGISRuntimeException> loadErrorProperty()
      Description copied from interface: Loadable
      The load error.
      Specified by:
      loadErrorProperty in interface Loadable
      Returns:
      the loadError property
      See Also: