JavaScript

A5.map.staticMap Method

A5.map.staticMap

Syntax

A5.map.staticMap(settings)

Arguments

settings

A JSON object that defines the criteria for generating the map

Options
Description
secure

A true or false value. Default false.

Determines whether an http or https protocol should be used when returning the image URL.

width

A numeric value. Default 400.

The width of the map image in pixels.

height

A numeric value. Default 300.

The height of the map image in pixels.

markers

An array of marker objects. Required if center and zoom are not provided.

A marker object has several properties. These properties are size, color, label, and location. Location is required. All other properties are optional.

See Marker Styles for information about the settings available for a marker's size and color.

center

Required if no markers are provided.

A location defining the center of the map. The center can be a latitude and longitude pair in the format 'latitude,longitude' or a street address.

zoom

Required if no markers are provided.

The zoom level of the map. See Google Map API Zoom Levels for more details.

scale

A numeric value. Optional.

Defines the image quality. EG, a scale of 2 will return twice as many pixels as a scale of 1. Useful for high-resolution displays. See Google Map API Scale Values for more details.

Description

The A5.map.staticMap() method returns a URL of a static Google Map image.

Discussion

A5.map.staticMap method generates a Google Maps image that can be embedded on a page. The A5.map.staticMap returns a URL to the image.

The settings parameter for the A5.map.staticMap method defines the map parameters. The settings define the size of the map as well as the map location, scale, any markers that should be displayed on the map, and the type protocol the image URL should use (HTTP or HTTPS.)

var marker1 = {};
marker1.size = 'mid';
marker1.color = 'red';
marker1.label = 'marker1';
marker1.location = '41.68761,-70.403640';

var marker2 = {
    size:'mid',
    color:'blue',
    label:'marker2',
    location:'123 Main St.,Boston,MA,02116,USA'
};

var markers = [];
markers.push(marker1);
markers.push(marker2);

var settings = {};
settings.markers = m;

A5.map.staticMap(settings);

Using staticMap in a Client-side Template 

A5.map.staticMap() can be used in Client-side template to display a static map (such as in a List control or ViewBox.) The example below is the Client-side template syntax to call the staticMap method:

<img src="{A5.map.staticMap(<escape<{width: 400,height: 300,center: 'Boston MA'}>>)}" />
Use the Layout tab's Insert... button in a ViewBox or FormView control, or the Map link in a List control with a Freeform Layout, to generate the template syntax to insert a static map.

See Also