Google maps removing controls

50,727

Solution 1

To customize the interface, I believe you have to delve into the Google Maps API.

Using the Google Maps API, you can set disableDefaultUI to true.

HTML File:

<!DOCTYPE html>
<head>
    <meta charset="utf-8" />
    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript" src="map.js"></script>
</head>
<body>
    <div id="map" style="width:200px; height:200px;" />
</body>
</html>

JavaScript file:

window.onload = function() {
    var myOptions = {
        center: new google.maps.LatLng(40.744556,-73.987378),
        zoom: 18,
        mapTypeId: google.maps.MapTypeId.ROADMAP,
        disableDefaultUI: true
    };

    var map = new google.maps.Map(document.getElementById("map"), myOptions);
}

Solution 2

I don't believe it is possible to hide controls when embedding the map. You will need to create a map in javascript by using Google Maps API - in lines of the following:

var mapContainer = document.getElementById('mapContainer');
var mapOptions = {
    panControl: false,
    zoomControl: false,
    scaleControl: false,
};
var map = new google.maps.Map(mapContainer, mapOptions);

Solution 3

There is not a parameter to hide the controls using IFRAME, look on the following link to see the possible parameters:

http://moz.com/ugc/everything-you-never-wanted-to-know-about-google-maps-parameters

If you do not want to use the API, you can use CSS to hide the edges of the map:

CSS:

.mapaThumb { position:relative; }
.mapaThumb iframe{ width:200px; height:240px; margin-top:-40px; margin-left:-10px; }
.mapaThumb .mapaItem{ overflow:hidden; height:150px; }

HTML:

<div class="mapaThumb">
    <div class="mapaItem">
        <iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com.br/maps?f=q&amp;source=s_q&amp;hl=pt-BR&amp;geocode=&amp;q=brazil&amp;aq=&amp;sll=-21.086832,-42.409844&amp;sspn=0.895645,1.674042&amp;ie=UTF8&amp;hq=&amp;hnear=Rep%C3%BAblica+Federativa+do+Brasil&amp;t=m&amp;z=4&amp;ll=-14.235004,-51.92528&amp;output=embed"></iframe>
    </div>
</div>

It is not the most correct, but it works! Old trick taught by a Chinese sage.

Share:
50,727
Eric Goncalves
Author by

Eric Goncalves

Hi.

Updated on September 10, 2020

Comments

  • Eric Goncalves
    Eric Goncalves over 3 years

    I am attempting to create a Google map of my company location. I used the link button on the Google maps page. Everything's fine, but when I shrink the map to 200 x 200 all the maps controls take over the map and blocks the view from the map. Is there a way to get ride of them? All I want is the pin and the zoom in and out button. Thank you.

    <iframe width="200" height="200" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"    src="https://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=244+5th+Avenue,+New+York,+NY&amp;aq=t&amp;sll=37.0625,-95.677068&amp;sspn=48.956293,107.138672&amp;ie=UTF8&amp;hq=&amp;hnear=244+5th+Ave,+New+York,+10016&amp;ll=40.744556,-73.987378&amp;spn=0.005763,0.013078&amp;t=m&amp;z=14&amp;output=embed"></iframe><br /><small><a href="https://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=244+5th+Avenue,+New+York,+NY&amp;aq=t&amp;sll=37.0625,-95.677068&amp;sspn=48.956293,107.138672&amp;ie=UTF8&amp;hq=&amp;hnear=244+5th+Ave,+New+York,+10016&amp;ll=40.744556,-73.987378&amp;spn=0.005763,0.013078&amp;t=m&amp;z=14" style="color:#0000FF;text-align:left">View Larger Map</a></small>
    
  • David Bélanger
    David Bélanger almost 12 years
    I've been working on this an hour ago and I can confirm this is the way the hide the full UI. +1
  • Nathron
    Nathron about 8 years
    They don't mention it anywhere on their page -- using this generator adds this affiliate spam link to your site: <a class="google-map-code" href="http://www.themecircle.net" id="get-map-data">wordpress themes</a>