See Differences between GoogleImageModel and GoogleLayer for a high-level overview of the different Google Maps APIs in LuciadRIA

You can visualize Google Maps Data with the GoogleImageModel. This model accesses the Google Static Maps API image service (v2).

The service access rights and usage limits depend on the type of your Google account, and on the agreement you have made with Google. Carefully review the Google Maps/Google Earth APIs Terms of Service at https://developers.google.com/maps/terms to determine if your application is permitted to use the Static Maps API.

With the GoogleImageModel you can visualize different map types, including roads, satellite photography, terrain maps or hybrid maps. Other configuration options include image format, language or region.

Using a public application key for Google Maps requests

To connect to the Google Maps Service with your Google Application key, pass that key as a request parameter to the model:

Program: Creating and visualizing a Google image model, with public application key authentication.
//Create a model using your application key
const model = new GoogleImageModel({
  requestParameters: {
    format: "png",
    maptype: "terrain",
    key: "{APPLICATION_KEY}"
  }
});

//Create a layer for the model
const layer = new RasterImageLayer(model);

//Add the layer to the map
map.layerTree.addChild(layer);

Using a proxy service to sign Google Maps requests

If you have a business agreement with Google, you will have received a Google business client ID. Business users can purchase additional requests, and requests have fewer restrictions on image size. To make requests to the Google Static Map API with such a business account, you need to sign each request with a private key that corresponds to that business client ID.

LuciadRIA includes a sample servlet that signs Google Maps requests on the server. You can configure the GoogleImageModel to use this service. The request includes just your business client identifier. In turn, the proxy signs the request with the corresponding private key and replies with a redirect message pointing to the signed URI. The browser will automatically download the resource from the correct location. With this approach, you do not have to include the private key in the JavaScript client code. This servlet is deployed by default under http://localhost:8072/gmaps.

Program: Creating a Google image model, using a business client identifier and the sample proxy
//Create a model using your business client identifier
const model = new GoogleImageModel({
  serviceUrl: "http://localhost:8072/gmaps/sign/staticmap",
  requestParameters: {
    format: "png",
    maptype: "terrain",
    client: "{CLIENT_ID}"
  }
});

//Create a layer for the model
const layer = new RasterImageLayer(model);

//Add the layer to the map
map.layerTree.addChild(layer);