function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Arunkumar RArunkumar R 

Google Map Components in Salesforce

Hi Guys,

    Hope so many peoples integrated google map in visualforce page using the javascript. From Salesforce Spring'15 onwards, Map components are released. Some of the people may not aware about this.

Please find the below link it will helpful who don't know about this component..!
Abilash Kosigi 8Abilash Kosigi 8
Hi all,

To add further to this, I have written a blog on leveraging Google charts in Salesforce. Please find below the link to it.
Sugandhi VermaSugandhi Verma
hi Arunkumar,
I'm not able to Enable Maps and Location Services. Please give the detail on how to enable it. As i am not able to see App Setup in my account.
Peter LantzPeter Lantz
Salesforce Map and Location is not available in devloper org . It is available in Sandbox org..
Google map with javascript..This page will get the current user location and it will create a record with location.

I have used this one with salesforce site. it is working awesome .. whoever visit my site, that person location saved in record.

<apex:page controller="RN_GeoWithJSController" wizard="true">
   <script type="text/javascript">
    function getLocation() {
    if (navigator.geolocation) {
    } else { 
        alert("Geolocation is not supported by this browser.");
    function showPosition(position) 
        var lat = position.coords.latitude;
        var long = position.coords.longitude;
        document.getElementById('{!$Component.form.pb.hidden1}').value = lat;
        document.getElementById('{!$Component.form.pb.hidden2}').value = long;
        var latlon = lat+","+long;
        var img_url = ""+latlon+"&zoom=14&size=800x300&sensor=false";
        document.getElementById('{!$Component.form.pb1}').innerHTML = "<img src='"+img_url+"'>";
    function myFunction() {
    var person = prompt("Please enter your name and be calm , We are tracking your location", "Harry Potter");
    if (person != null) {
        document.getElementById('{!$Component.form.pb.lanName}').value = person;
    <apex:form id="form">
    <apex:actionFunction name="save" action="{!saveLocation}" rerender="pb" />
        <apex:pageBlock id="pb">
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!saveLocation}" />
                <apex:commandButton value="Cancel" action="{!cancelLocation}"/>
            Name:<apex:inputField value="{!objLongnLat.Name}" id="lanName"/>
            <apex:inputHidden value="{!objLongnLat.Location__Latitude__s}" id="hidden1"/>
            <apex:inputHidden value="{!objLongnLat.Location__Longitude__s}" id="hidden2"/>
        <apex:pageBlock id="pb1">
public class RN_GeoWithJSController 
    public LongitudeAndLatitude__c objLongnLat {get;set;}
    public RN_GeoWithJSController()
        objLongnLat = new LongitudeAndLatitude__c();
    public PageReference saveLocation()
        insert objLongnLat;
        string strlocation = objLongnLat.Location__Latitude__s +','+ objLongnLat.Location__Longitude__s;
        //PageReference acctPage = new ApexPages.StandardController(objLongnLat).view();
        PageReference acctPage = new PageReference(''+strlocation+'&zoom=14&size=400x300&sensor=false');
        return acctPage;
    public PageReference cancelLocation()
        PageReference acctPage = new PageReference('');
        return acctPage;
} (" target="_parent)
Calvin NoronhaCalvin Noronha
My blog about easily adding Google maps to your VF page. 
Please ping me with any questions related to this.