Obtaining a Bing Maps keys

The first thing you need before connecting to the Bing Maps servers is a Bing Maps developer key. The Bing Maps portal (http://www.bingmapsportal.com) allows you to create a Bing Maps account and one or more Bing Maps keys.

To request a Bing Maps key from Microsoft:

  1. Go to http://www.bingmapsportal.com.

  2. Sign in with your Windows Live ID, or create one.

  3. Click "Create or view keys".

  4. Choose "Evaluation / Trial" and click Submit. The key is created.

Note that additional terms may apply for deployment. For more information on Bing Maps licensing, see the Licensing info guide.

Visualizing the data on the map

Visualizing Bing Maps data on a GXY view requires the same two steps as the majority of the formats:

An additional step compared to other formats is that Bing Maps terms of use from Microsoft require to show copyright information on the map.

// Create the bing maps data source to specify what kind of data we want
TLcdBingMapsDataSource dataSource =
    new TLcdBingMapsDataSourceBuilder(applicationID)

//Decode the data source into a model
ILcdModelDecoder decoder = new TLcdCompositeModelDecoder(
ILcdModel model = decoder.decodeSource(dataSource);

//Create an async layer for it
ILcdGXYLayer layer = new TLcdBingMapsGXYLayerFactory().createGXYLayer(model);
layer = ILcdGXYAsynchronousLayerWrapper.create(layer);

//Add the layer to the view

//The BingMaps license agreement requires to display the icon and copyright information on the map
TLcdBingMapsLogoIcon logoIcon = new TLcdBingMapsLogoIcon(view);
overlayPanel.add(logoIcon.asComponent(), TLcdOverlayLayout.Location.SOUTH_WEST);

TLcdBingMapsGXYCopyrightIcon copyrightIcon = new TLcdBingMapsGXYCopyrightIcon(view);
overlayPanel.add(copyrightIcon.asComponent(), TLcdOverlayLayout.Location.SOUTH_WEST);

This results in a Bing Maps layer with default styling.

This code snippet uses the TLcdCompositeModelDecoder initialized with all available model decoders in the service registry.

The actual model decoder class responsible for decoding Bing Maps data sources is the TLcdBingMapsModelDecoder.