Maps communicate information more clearly than mere
location data. Visualforce mapping
components make it simple to create maps that use third-party mapping services. Visualforce maps are interactive,
JavaScript-based maps, complete with zooming, panning, and markers based on your Salesforce or other data. Create standalone
map pages, maps that you can insert into page layouts, and even mobile maps for Salesforce1.
Visualforce provides a set of related mapping
components. The <apex:map> component defines the map
canvas, including size, type, center point, and initial zoom level. The <apex:mapMarker> child component defines the markers to place
on the map by address or geolocation (latitude and longitude). You can use the <apex:mapInfoWindow> component to add customizable
information panels that appear when a marker is clicked or tapped.
Visualforce mapping components aren’t
available in Developer Edition organizations.
Maps that you define in Visualforce markup generate JavaScript code
to render onto the page. This JavaScript connects to a mapping service and builds the map by
fetching map tiles and placing markers. If your items to be mapped don’t have a latitude and
longitude, Visualforce maps can geocode
their addresses. After the map renders, your users can interact with the map by panning and
zooming, just like they’re used to with other map sites. The effect is as if you wrote your own
custom JavaScript to interact with a third-party mapping service, but without actually needing to
write it. You define the map in Visualforce and get the mapping JavaScript for free.
Visualforce mapping
components add JavaScript to your page, and use third-party JavaScript code to draw the map.
- JavaScript added by Visualforce uses
industry-standard best practices to avoid conflicts with other JavaScript executing on the same
page. If your own JavaScript doesn’t also use best practices, it could conflict with the
mapping code.
- Addresses that need geocoding—that is, locations that don’t include values for latitude and
longitude—are sent to a third-party service for geocoding. These addresses aren’t associated
with your organization, and no other data is sent other than what you provide in your Visualforce markup. However, if your
organization requires strict control of data shared outside of Salesforce, don’t use the geocoding
feature of Visualforce maps.