Google Maps does not load correctly

1

My site is experiencing display issues on a map (Google Maps) when accessed by the main url: link

but displays the same map correctly when accessed by this other URL: link

If I access the site by this other url link also gives map error.

Would anyone know what might be causing this?

The html code of the map is dynamically created within the following div <div id="map-canvas" style="min-height:248px; width:100%;"></div> , and I will check that this div is present on both pages that I cited.

The functions that should dynamically create the map are:

<script src="https://maps.googleapis.com/maps/api/js?key=API_KEY"></script><script>varmapMarker="http://www.localizaip.com/site/images/geo_icon.png";
var latLngHome = new google.maps.LatLng("99,9999999","99,9999999");
var infoHome = '<div id="content">'+'<div id="siteNotice">'+'</div>'+'<h4 id="firstHeading" class="firstHeading">Localização</h4>'+'<div id="bodyContent">'+'<p>Rua Tal<br/>Bairro, Cidade<br/>Estado - Brazil</p>'+'</div>'+'</div>';  

function initialize(myLatlng,infoWindowString) {

    if($('#map-canvas').length > 0){

          //var myLatlng = new google.maps.LatLng("","");
          var mapOptions = {
            zoom: 15,
            center: myLatlng
          }
          var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

          // Image Marker
          var image = mapMarker;
          var beachMarker = new google.maps.Marker({
            position: myLatlng,
            map: map,
            icon: image,
            title: 'Localização'                
          });

          var infowindow = new google.maps.InfoWindow({
              content: infoWindowString
          });


        google.maps.event.addListener(beachMarker, 'click', function() {
            infowindow.open(map,beachMarker);
        });

    }

}

var $ = jQuery.noConflict($);
$(document).ready(function(){    
     google.maps.event.addDomListener(window, 'load', initialize(latLngHome,infoHome));
});
</script>

But for some reason it is not working ..

  

Note: These errors started to appear after I installed a PHP translation system on the site (php-gettext), but with the implementation of this system, no changes were made to javascript, which I found stranger because I do not understand how a PHP system could affect the functionality of the map that is created using javascript.

    
asked by anonymous 17.05.2016 / 23:32

2 answers

0

I discovered that my problem was related to PHP language implementation scripts (php-gettext).

Below is the code for how I solved:

<?php

putenv('LANGUAGE=' . $locale);
putenv('LANG=' . $locale);
//putenv('LC_ALL=' . $locale); //Desabilitei esta linha 
putenv('LC_MESSAGES=' . $locale);

setlocale(LC_MESSAGES, $locale);
setlocale(LC_CTYPE, $locale);
//setlocale(LC_ALL, $locale); //Desabilitei esta linha

?>

I believe that somehow the language setting was affecting the display of Google Maps. But disabling only two lines of the above script was able to solve the problem, without affecting the functionality of the translation system.

    
18.05.2016 / 20:13
-1

Good evening. On the page that is working I found in the code, the div that displays the map:

Already on the pages that are displaying the error, I have not found it is part of the code. Have you checked if it's correct? If you are not missing the div where the map is displayed on these pages with error?

    
18.05.2016 / 05:45