Show streets and images in Type Satellite by default

Asked

Viewed 346 times

1

I am wanting to show the names of the streets and establishments by default. What would be the option? I am doing so:

var myOptions = {
    scrollwheel: false,
    center: new google.maps.LatLng(lat, centerLon),
    zoom: 15,
    mapTypeId: google.maps.MapTypeId.SATELLITE
};

2 answers

1


In map options there are no properties to enable these options explicitly, they already come with the view type. To display as you need, just use the view HYBRID, in this way:

var options = {
    scrollwheel: false,
    center: new google.maps.LatLng(lat, centerLon),
    zoom: 15,
    mapTypeId: google.maps.MapTypeId.HYBRID
};

See a full example below:

var gm = google.maps;

function initialize() {
  var options = {
    zoom: 15,
    center: new gm.LatLng(-27.593427, -48.550686),
    mapTypeId: gm.MapTypeId.HYBRID,
    scrollwheel: false
  };

  var map = new gm.Map(document.getElementById("map"), options);

}

gm.event.addDomListener(window, 'load', initialize);
body {
    margin: 0;
}
#map {
  height: 600px;
  width: 100%;
}
<script src="https://maps.googleapis.com/maps/api/js"></script>

<body>
    <div id="map"></div>
</body>

0

You have to declare the type of map as ROADMAP, which is the default MAPS API option.

Leave it at that:

var myOptions = {
    scrollwheel: false,
    center: new google.maps.LatLng(lat, centerLon),
    zoom: 15,
    mapTypeId: google.maps.MapTypeId.ROADMAP
};
  • the ROADMAP shows the name of the streets and establishments, that’s what I want but using Satellite.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.