Class BingMapsLayer

  • All Implemented Interfaces:
    RemoteResource, LayerContent, Loadable

    public final class BingMapsLayer
    extends ServiceImageTiledLayer
    Displays Bing maps layers.

    A Bing maps layer displays map content from a Bing Maps web service, providing access to static map tiles and imagery metadata.

    Map style and culture can be customized prior to loading the layer.

    Functional characteristics

    Bing maps require an API key from Microsoft. There are two ways to set this key:

    A Bing maps layer will fail to load if it does not have a Bing map key or a Portal from where it can get the Bing map key. In this situation, you can call setKey(String) and call Layer.retryLoadAsync().

    Bing maps layers do not support identify, query, selection, or time.

    Use of BingMapsLayer in ArcGIS Runtime requires adherence to Microsoft's Mobile Brand Guidelines.

    Performance characteristics

    Bing maps layers perform similarly to other tiled layers. Raster tiles are fetched from Bing's servers on demand.

    Example for working with Bing Maps layer

     BingMapsLayer bingMapsLayer = new BingMapsLayer(Style.AERIAL, <bing-maps-key>");
     
     bingMapsLayer.addDoneLoadingListener(new Runnable() {
       public void run() {
         if (bingMapsLayer.getLoadStatus() == LoadStatus.LOADED) {
           // work with bingMapsLayer here
         }
       }
     });
     
     map.getOperationalLayers().add(bingMapsLayer);
     
    The layer is loaded when displayed in a MapView or a SceneView; if using the layer without a MapView or a SceneView, call the Layer.loadAsync() method. Use the layer done loading event to determine when the layer is ready, and check the load status before using the layer; see Layer.addDoneLoadingListener(Runnable) and Layer.getLoadStatus().
    Since:
    100.1.0
    See Also:
    Layer
    • Constructor Detail

      • BingMapsLayer

        public BingMapsLayer​(BingMapsLayer.Style style,
                             Portal portal)
        Creates a new BingMapsLayer from a style and Portal.
        Parameters:
        style - style of the Bing maps layer
        portal - portal with the Bing maps key
        Throws:
        java.lang.IllegalArgumentException - if style is null
        java.lang.IllegalArgumentException - if portal is null
        Since:
        100.1.0
      • BingMapsLayer

        public BingMapsLayer​(BingMapsLayer.Style style,
                             java.lang.String key)
        Creates a new BingMapsLayer from a style and key.
        Parameters:
        style - style of the Bing maps layer
        key - the Bing maps key
        Throws:
        java.lang.IllegalArgumentException - if style is null
        java.lang.IllegalArgumentException - if key is null or empty
        Since:
        100.1.0
    • Method Detail

      • getCulture

        public java.lang.String getCulture()
        Gets the culture that was set, or "en-US" if not set or was set to an invalid value.
        Returns:
        the culture that was set, or "en-US" if not set or was set to an invalid value
        Since:
        100.1.0
      • setCulture

        public void setCulture​(java.lang.String culture)
        Sets the culture.

        This determines the language that is used to display text. If the culture is not set or is set to an invalid value, then "en-US" is used.

        See Supported Culture Codes for a list of valid culture codes.

        This should be called before loading the layer.

        Parameters:
        culture - the culture to set
        Throws:
        java.lang.IllegalArgumentException - if culture is null or empty
        ArcGISRuntimeException - if set after the layer has loaded
        Since:
        100.1.0
      • getPortal

        public Portal getPortal()
        Gets the Portal the layer will load its Bing Maps API key from.
        Returns:
        the Portal the layer will load its Bing Maps API key from, or null if none
        Since:
        100.1.0
        See Also:
        Portal
      • getStyle

        public BingMapsLayer.Style getStyle()
        Gets the style used to create this layer.
        Returns:
        the style used to created this layer
        Since:
        100.1.0
      • getKey

        public java.lang.String getKey()
        Gets the key that was set.
        Returns:
        the key that was set
        Since:
        100.1.0
      • setKey

        public void setKey​(java.lang.String key)
        Sets the key.
        Parameters:
        key - the key to set
        Throws:
        java.lang.IllegalArgumentException - if key is null or empty
        Since:
        100.1.0
      • getUri

        public java.lang.String getUri()
        Throws UnsupportedOperationException.
        Returns:
        the URI of this RemoteResource
        Throws:
        java.lang.UnsupportedOperationException - always throws this exception
        Since:
        100.1.0
      • getTileUrl

        protected java.lang.String getTileUrl​(TileKey tileKey)
        Throws UnsupportedOperationException.
        Specified by:
        getTileUrl in class ServiceImageTiledLayer
        Parameters:
        tileKey - tile key for which the url is to be returned
        Returns:
        the url to be used to request a tile, can't be null or empty
        Throws:
        java.lang.UnsupportedOperationException - always throws this exception
        Since:
        100.1.0
      • copy

        public BingMapsLayer copy()
        Creates a deep copy of this BingMapsLayer instance.
        Returns:
        a deep copy of this BingMapsLayer instance, which means that copies of all fields of this layer are made including its loading state
        Since:
        100.1.0