Integrating Google Map Using New Spring 15 Visualforce Components

            Most of us already known about the Google Map integration in Salesforce. For integrating Google map in previous releases we used Java script calls, referring some of resource files, etc.  But in Spring’15 release it is too simplified. There are two new Visualforce mapping components introduced that are,

                          – Display an interactive map with Zooming, Scrolling, markers.
               – Defines a marker to be displayed at a location.

Steps to Enable Map Feature

Before using this new feature, we need to enable this in salesforce organization,

            Go to App Setup in the Side Bar à Maps and Location à Setting àEdit à Check Enable Maps and Location Services.

  1. <apex:page standardController=“Account”>
  2.     <apex:pageBlock>
  3.         <apex:map width=“1000px” height=“400px” mapType=“roadmap”
  4.                   center=“{!Account.BillingStreet},{!Account.BillingCity},{!Account.BillinState}”>
  5.             <apex:repeat value=“{!Account.Contacts}” var=“contact”>
  6.                 <apex:mapMarker title=“{!contact.Name}”
  7.                                 position=“{!contact.MailingStreet},{!contact.MailingCity},{!contact.MailingState}”/>
  8.             </apex:repeat>
  9.         </apex:map>
  10.     </apex:pageBlock>
  11. </apex:page>

Limitation

1. Visualforce mapping components aren’t currently available in Developer Edition organizations.
2. There’s a limit of 10 geocoded address lookups per page request. It means you can see maximum of 10 pointers in the map.  Center and Position attribute values counted in this limit.

Reference

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a comment