", "answerCount": 3, "upvoteCount": 0, "datePublished": "2015-05-27T07:07:57.000Z", "author": { "@type": "Person", "name": "Manjunath V", "url": "https://trailblazers.salesforce.com/profileView?u=00530000009rAslAAE", "affiliation": { "@type": "Organization", "name": "Apptio" } }, "suggestedAnswer": [ { "@type": "Answer", "text": "Hi Manju,   Programmatic questions are best posted at developer boards as this community is only focused on setup and configuration.   https://developer.salesforce.com/forums/#!/feedtype=RECENT&criteria=ALLQUESTIONS ( https://developer.salesforce.com/forums/#!/feedtype=RECENT&criteria=ALLQUESTIONS )   https://salesforce.stackexchange.com   Thanks,   Pritam Shekhawat", "upvoteCount": 1, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A7f9JSAR", "datePublished": "2015-05-27T07:40:37.000Z", "author": { "@type": "Person", "name": "Pritam Shekhawat", "url": "https://trailblazers.salesforce.com/profileView?u=00530000009rpvmAAA", "affiliation": { "@type": "Organization", "name": "PwC South East Asia Consulting" } } } ] } }
Skip to main content
Manjunath V (Apptio) a posé une question dans #Customer Service
<script>

 

  

 

       var map;

 

       function initialize1() {

 

          var mapOptions = {

 

    zoom: 15,

 

    mapTypeId: google.maps.MapTypeId.SATELLITE,

 

    mapTypeControl: false

 

  }

 

           map = new google.maps.Map(document.getElementById('map-canvas'),

 

               mapOptions);

 

           // Try HTML5 geolocation

 

           if (navigator.geolocation) {

 

               navigator.geolocation.getCurrentPosition(function (position) {

 

                   var pos = new google.maps.LatLng(position.coords.Latitude ,

 

                                                    position.coords.Longitude);

 

                   var infowindow = new google.maps.InfoWindow({

 

                       map: map,

 

                       position: pos,

 

                       content: 'Location found using HTML5.'

 

                   });

 

                   map.setCenter(pos);

 

               }, function () {

 

                   handleNoGeolocation(true);

 

               });

 

           } else {

 

               // Browser doesnot support Geolocation

 

               handleNoGeolocation(false);

 

           }

 

       }

 

 

 

    

 

  

 

  

 

       function initialize() {

 

           var mapOptions = {

 

               zoom: 6

 

           };

 

          

 

           map = new google.maps.Map(document.getElementById('map-canvas'),

 

               mapOptions);

 

           // Try HTML5 geolocation

 

           if (navigator.geolocation) {

 

               navigator.geolocation.getCurrentPosition(function (position) {

 

                 var latlongs = {!Station__c.LocationCoordinates__Latitude__s }; //position.coords.latitude position.coords.longitude 

 

$("#.00ND0000004eEjCj_id0_j_id26_j_id27_ileinner");

 

                var  longtudes = {! Station__c.LocationCoordinates__Longitude__s};

 

                   var pos = new google.maps.LatLng(latlongs, longtudes );

 

                   var infowindow = new google.maps.InfoWindow({

 

                       //map: map,

 

                       //position: pos,

 

                       content: 'Location found using HTML5.'

 

                   });

 

                  

 

                   

 

                   var marker = new google.maps.Marker({

 

                      position: pos,

 

                      map: map

 

                    });

 

                    

 

                     map.setCenter(pos);

 

                   

 

                    google.maps.event.addListener(marker, 'mouseover', function() {

 

                            infowindow.open(marker.get('map'), marker);

 

                  });

 

                   google.maps.event.addListener(marker, 'mouseout', function() {

 

                            infowindow.close();

 

                  });

 

               }, function () {

 

                   handleNoGeolocation(true);

 

               });

 

           } else {

 

               // Browser doesnot support Geolocation

 

               handleNoGeolocation(false);

 

           }

 

       }

 

       function handleNoGeolocation(errorFlag) {

 

           if (errorFlag) {

 

               var content = 'Error: The Geolocation service failed.';

 

           } else {

 

               var content = 'Error: Your browser doesnot support geolocation.';

 

           }

 

           var options = {

 

               map: map,

 

               position: new google.maps.LatLng(60, 105),

 

               content: content

 

           };

 

           var infowindow = new google.maps.InfoWindow(options);

 

           map.setCenter(options.position);           

 

           

 

       }

 

       google.maps.event.addDomListener(window, 'load', initialize);

 

     

 

    </script> 
3 réponses
0/9000