How to remove br information from maps?

Asked

Viewed 1,153 times

-1

I am developing a wev application of geolocation of rains. On the map I want only the points of capture of rains. However, the default map provided by google provides with road information (br’s). There are ways to remove this information and leave the map clean?

1 answer

2

This is included in the documentation of Google Maps itself:

https://developers.google.com/maps/documentation/javascript/styling

See a very simple example, with examples of color change, and with road names removed (it’s just an example, you can customize the whole map by removing or styling each of the parts):

function initialize() {
  var styles = [{
    stylers: [{
      hue: "#00ffe6"
    }, {
      saturation: -20
    }]
  }, {
    featureType: "road",
    elementType: "geometry",
    stylers: [{
      lightness: 100
    }, {
      visibility: "simplified"
    }]
  }, {
    featureType: "road",
    elementType: "labels",
    stylers: [{
      visibility: "off"
    }]
  }];
  var styledMap = new google.maps.StyledMapType(styles, {
    name: "Styled Map"
  });
  var mapOptions = {
    zoom: 18,
    center: new google.maps.LatLng(-23.55, -46.633333),
    mapTypeControlOptions: {
      mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'map_style']
    }
  };
  var map = new google.maps.Map(document.getElementById('map'), mapOptions);
  map.mapTypes.set('map_style', styledMap);
  map.setMapTypeId('map_style');
}

See working on CODEPEN.


Tool for online customization:

To avoid the trouble of creating the configuration manually, has a very cool tool at this address to automate and do preview of the settings:

http://instrument.github.io/styled-maps-wizard

Just choose elements, set up as you like. To set several items separately, simply add a new item to the right bar after customizing the current one. Each item added generates an entry in the configuration object.

  • Here is a tool to generate the configuration already online: http://instrument.github.io/styled-maps-wizard/

Browser other questions tagged

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