Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps API V3 : weird UI display glitches (with screenshot)

Anyone with any ideas on what's causing this weird glitch with the google maps UI components, be really grateful to hear from you!

enter image description here

the map is created with:

        var options = {         zoom: <?php echo $this->zoom ?>,         center: new google.maps.LatLng(<?php echo $this->centre_lat ?>, <?php echo $this->centre_lon ?>),             mapTypeControl: false,             mapTypeId: google.maps.MapTypeId.ROADMAP                         };           var map = new google.maps.Map(document.getElementById('map_canvas'), options); 

and the glitch is the same even with no markers.

like image 246
Haroldo Avatar asked Sep 19 '11 13:09

Haroldo


People also ask

Is Google Maps screenshot legal?

Street View imagery can only be used in digital advertisements where you're using the Google Maps APIs or the imagery is embedded or linked to on your website using HTML and URL provided on Google Maps. You may not screenshot Street View imagery or remove it from embedded sources for any purpose.

How do I get rid of Google Maps UI?

Disabling the UI Default Controls We can disable the default UI controls provided by Google Maps simply by making the disableDefaultUI value true in the map options.

Did Google Maps API change?

A valid API key and a Google Cloud Platform billing account are now required. The change was made to combat free API keys overusing the API and servers due to high traffic and having their services interrupted if they went over usage limits.


1 Answers

We ran into the same problem. The css designer was using this style:

style.css

img {max-width: 100%; } 

Instead of disabling the zoom control, we fixed the problem by overriding the img style for map_canvas elements like so:

style.css:

#map_canvas img { max-width: none; } 

The zoom control now displays correctly.

Setting "img max-width:100%" is a technique employed in responsive/fluid web site design so that images re-size proportionally when the browser is re-sized. Apparently some css grid systems have started setting this style by default. More info about fluid images here: http://www.alistapart.com/articles/fluid-images/ Not sure why this conflicts with the google map...

like image 145
Patrick Cullen Avatar answered Oct 13 '22 06:10

Patrick Cullen