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,
<apex: map> - Display an interactive map with
Zooming, Scrolling, markers.
<apex: mapMarker> - 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.
- <apex:page standardController="Account">
- <apex:pageBlock>
- <apex:map width="1000px" height="400px" mapType="roadmap"
- center="{!Account.BillingStreet},{!Account.BillingCity},{!Account.BillinState}">
- <apex:repeat value="{!Account.Contacts}" var="contact">
- <apex:mapMarker title="{!contact.Name}"
- position="{!contact.MailingStreet},{!contact.MailingCity},{!contact.MailingState}"/>
- </apex:repeat>
- </apex:map>
- </apex:pageBlock>
- </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
No comments:
Post a Comment