Geopointe

Creating a Static Map with Salesforce Maps

Static maps was a Geopointe feature that was retired with the June '15 release. However, you can achieve the same functionality using Salesforce maps. By creating a simple Visualforce page, you can embed a static map of a record location on page layouts.


Follow these steps to add a static map to record pages:

1. Navigate to Visualforce Pages in Setup (in Classic, this is under Develop; in Lightning, it is under Custom Code).

2. Click New and give the page a name you will recognize once you're ready to add it to your page layout.

3. Enter your code into the Visualforce Markup section.

The example code below implements a static map of an Account record, clickable out to a Geopointe map:
<apex:page standardController="Account" showHeader="false" sidebar="false" cache="false">
    <style type="text/css" media="all">
        body{margin: 0; padding: 0;}
    </style>
   
    <div style="cursor: pointer; width: 100%; height: 300px; position: absolute; z-index: 1000;" onclick="window.top.location.href = '/apex/geopointe__Map?id={!Account.Id}'"></div>
   
    <div style="margin: 5px auto; width: 85%;">
        <apex:map width="100%" height="300px" mapType="roadmap" zoomLevel="15">
            <apex:mapMarker position="{latitude:{!account.geopointe__geocode__r.geopointe__Latitude__c},longitude:{!account.geopointe__geocode__r.geopointe__Longitude__c}}"/>
        </apex:map>   
    </div>
       
</apex:page>

This code will work for Accounts. To adjust it for other objects, make these changes:

- Change the word Account with the API name of the object you want. (For custom objects, that will include "__c" at the end.)

- If it's a custom object, change the geocode field names by removing the geopointe namespace.

Replace !account.geopointe__geocode__r.geopointe__Latitude__c

  with  geocode__r.geopointe__Latitude__c

and
!account.geopointe__geocode__r.geopointe__Longitude__c

with geocode__r.geopointe__Longitude__c

4. Navigate to the page layout editor for that object. Under the Visualforce Pages section, select and drag your new map page to an appropriate place in the layout.