如何获得没有标签的地图?

时间:2012-02-25 14:21:52

标签: google-maps

我想得到一张有道路网络的地图(我只需要一张图片) 但没有标签(地图上的文字)。我试图从Google API获取此类地图,并认为"element:geometry" 的工作原理。

但是,例如,this link仍然充满了文字。

如何在没有文字标签的情况下获得道路网络地图(静态图片没问题)? 任何提供商都可以,例如谷歌,雅虎,Mapquest ......

5 个答案:

答案 0 :(得分:40)

使用此风格:

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

它会隐藏所有功能的所有标签。

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

答案 1 :(得分:6)

我得到了更好的解决方案:

创建一个html文件并在下面插入代码。

<!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>

希望它有所帮助! :)

答案 2 :(得分:4)

关于JavaScript API的地图样式的

This is the documentation。还有一个Styled Map Wizard,可以让你玩风格来获得你想要的。

答案 3 :(得分:2)

Google地图样式化地图向导(下面的链接)将允许您删除标签(并进行大量其他自定义)。

https://mapstyle.withgoogle.com/

答案 4 :(得分:0)

通过“我只需要一张图片”我认为你不需要访问API,Google Inc开发人员仍然没有机会将旧地图的所有功能应用到新设计中。 但是,您仍然可以转到https://maps.google.com/?output=classic

来访问它

你可以去设置并自定义“勾选标签”等等......