Skip to main content
LinkedIn
Copied!

Table of Contents

Displaying location as static map image

Applicable to Theme UI-Kit applications

Harness and Section forms - displaying location as a static map image

The Static Maps API uses an API key to identify your application. API keys are managed through the Google APIs Console. For more information, see Get an API Key tutorial from Google.

Using the Google Static Maps API facilitates showing an address or longitude/latitude coordinates as a static map image containing a pin with the location. This allows users to display a geographical location visually in an application, for instance, when offline. To accomplish this, invoke the pyFetchStaticMap activity with a set of parameters.

The pyFetchStaticMap activity populates any property with a Base64 image data representing the map and uses that property as an image source with the Icon /Image control. The use cases for pyFetchStaticMap are unlimited since it can be called from any other activity. Some of its most common use cases are outlined below - when you want to:

  • Show a static image map immediately:
    • call this activity from a post-load processing activity of a data page
    • call this activity from a preprocessing activity of a flow action
  • Save a static map image data to a database:
    • use the activity from a postprocessing activity of a flow action

The following steps describe a user case calling the pyFetchStaticMap activity from a post-load processing activity of a data page. Step 1 is always performed no matter the context.

  1. Define an image (the Icon/Image control), for instance, in a section. It will represent the target property where the static Google map with the address location will be saved and displayed.

  2. Create a post-load processing activity for a data page.

  3. In the Steps tab invoke the pyFetchStaticMap activity by entering Call pyFetchStaticMap in the Method field.

  4. Make sure to define a step page context.

  5. Expand and enter values for the method's parameters:

    Name Description
    targetProperty Required. Defines target property where the static Google map image with location is to be saved. The entered value must be in double quotes. The format should be Text. The map image data is saved in Base64 format in this property.
    markerAddress Required. A property which references a longitude/latitude coordinates or a human-readable geographical address of the location to be displayed in the static map, for instance, "40.689249, -74.044516" or "Statue of Liberty, Liberty Island, Brooklyn, NY 11231, USA".
    width Required. The width of the image in pixels, for instance, 300.
    height Required. The height of the image in pixels., for instance, 100.
    zoomLevel Specifies the zoom level on the map. Only values between 0 and 21 (inclusive) are permitted. The default value is 15.
    mapType Defines the type of Google map to display:
    • roadmap (default)
    • satellite
    • hybrid
    • terrain
    imageType Defines the type of image to use:
    • GIF
    • JPEG
    • PNG (default)

Related Content

Article

harnesses

Article

Sections
Did you find this content helpful?

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Ready to crush complexity?

Experience the benefits of Pega Community when you log in.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us