If you need to pass multiple latitude and longitude coordinates to display multiple markers on the map in Pega, you can achieve this by using a Data Page or any other appropriate method for data storage and retrieval within the Pega platform.
Here’s a general outline of how you could approach this:
- Define a Data Page: In Pega, a Data Page is a way to store and manage data that can be used across multiple parts of an application. You can create a Data Page that holds a list of latitude and longitude coordinates.
- Populate the Data Page: Depending on your use case, you can populate the Data Page using various methods. For example, you can use an Activity, Data Transform, or Report Definition to fetch the latitude and longitude data from a data source (e.g., a database or an external API) and store it in the Data Page.
- Customize the HTML/JavaScript: You can customize the HTML/JavaScript in Pega to iterate over the list of latitude and longitude coordinates stored in the Data Page and display markers for each coordinate on the map.
Here’s a simplified example using a JavaScript function to add multiple markers to the map:
Assuming you have a Data Page called “LatLngDataPage” with the structure containing a list of latitude and longitude pairs:
And your HTML/JavaScript code could be like this:
Make sure to replace YOUR_API_KEY
with your actual Google Maps API key, and adjust the Data Page and property names according to your Pega application’s configuration.
Please note that the code provided is just a basic example and might need to be adapted based on the specifics of your Pega implementation and the way data is stored and accessed within your application.