How to get a map without labels?

前端 未结 5 2048
别那么骄傲
别那么骄傲 2021-02-07 11:13

I want to get a map (I only need a picture) that has the road network but without labels (text on the map). I tried to get such a map from Google API and thought \"element

相关标签:
5条回答
  • 2021-02-07 11:52

    Use this style:

    style=feature:all|element:labels|visibility:off
    

    it will hide all labels for all features.

    http://maps.google.com/maps/api/staticmap?sensor=false&size=512x512&center=Brooklyn&zoom=12&style=feature:all|element:labels|visibility:off

    0 讨论(0)
  • 2021-02-07 11:52

    by "I only need a picture" I take it you don't need to access to API, Google Inc devs still didn't a chance to apply all the features from the old maps to the new design. However you can still access it by going to https://maps.google.com/?output=classic

    and you can go to settings and customise "tick labels off" and so forth...

    0 讨论(0)
  • 2021-02-07 11:58

    The Google Maps Styled Map Wizard (link below) will allow you to remove labels (and also make tons of other customizations).

    https://mapstyle.withgoogle.com/

    0 讨论(0)
  • 2021-02-07 12:00

    This is the documentation on map styling for the JavaScript API. There's also a Styled Map Wizard that lets you play with the styles to get exactly what you want.

    0 讨论(0)
  • 2021-02-07 12:11

    I got a better solution:

    Create a html file and insert the code below.

    <!DOCTYPE html>
    <html>
      <head>
        <title>Mapa GMR Norte</title>
        <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
        <meta charset="utf-8">
        <style>
          html, body {
            height: 100%;
            margin: 0;
            padding: 0;
          }
          #map {
            height: 100%;
          }
        </style>
      </head>
      <body>
        <div id="map"></div>
        <script>
    function initMap() {
      var customMapType = new google.maps.StyledMapType([
          {
            elementType: 'labels',
            stylers: [{visibility: 'off'}]
          }
        ], {
          name: 'Custom Style'
      });
      var customMapTypeId = 'custom_style';
    
      var map = new google.maps.Map(document.getElementById('map'), {
        zoom: 13,
        center: {lat: 41.4416459, lng: -8.2911885},  // Brooklyn.
        mapTypeControlOptions: {
          mapTypeIds: [google.maps.MapTypeId.ROADMAP, customMapTypeId]
        }
      });
    
      map.mapTypes.set(customMapTypeId, customMapType);
      map.setMapTypeId(customMapTypeId);
    }
    
        </script>
        <script src="https://maps.googleapis.com/maps/api/js?signed_in=true&callback=initMap"
            async defer></script>
      </body>
    </html>
    

    Hope it helps! :)

    0 讨论(0)
提交回复
热议问题