Newer Version Available
apex:mapMarker
Defines a marker to be displayed at a location on an <apex:map>.
Note: This component must be enclosed within an <apex:map> component. You can add up to 100 <apex:mapMarker> components to a single map.
Map of Contacts for an Account
1<apex:page standardController="Account">
2
3 <!-- This page must be accessed with an Account Id in the URL. For example:
4 https://<salesforceInstance>/apex/NearbyContacts?id=001D000000JRBet -->
5
6 <apex:pageBlock >
7 <apex:pageBlockSection title="Contacts For {! Account.Name }">
8
9 <apex:dataList value="{! Account.Contacts }" var="contact">
10 <apex:outputText value="{! contact.Name }" />
11 </apex:dataList>
12
13 </apex:pageBlockSection>
14 </apex:pageBlock>
15
16 <apex:map width="600px" height="400px" mapType="roadmap"
17 center="{!Account.BillingStreet},{!Account.BillingCity},{!Account.BillingState}">
18
19 <apex:repeat value="{! Account.Contacts }" var="contact">
20 <apex:mapMarker title="{! contact.Name }"
21 position="{!contact.MailingStreet},{!contact.MailingCity},{!contact.MailingState}"
22 />
23 </apex:repeat>
24
25 </apex:map>
26
27</apex:page>Attributes
| Attribute Name | Attribute Type | Description | Required? | API Version | Access |
|---|---|---|---|---|---|
| icon | String | An absolute or fully qualified URL of the icon to be displayed for this marker. If you use images from a static resource, use the URLFOR() function to obtain the image URL. | 34.0 | ||
| id | String | An identifier that allows other components in the page to reference this component. | 32.0 | global | |
| position | Object |
Specifies the location of the marker. There are several ways to define the location:
Note: You can have up to 10 geocoded address lookups per map. Lookups for both the center attribute of the <apex:map> component and the position attribute of the <apex:mapMarker> component count against this limit. To display more markers, provide position values that don't require geocoding. Locations that exceed the geocoding limit are skipped. |
Yes | 32.0 | |
| rendered | Boolean | A Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true. | 32.0 | ||
| title | String | Text to display when the user's cursor moves over the marker. That is, when the marker's mouseover event is triggered. | 32.0 |