最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to create an empty google map with only street names - Stack Overflow

programmeradmin1浏览0评论

I am working on a Geolocation application in which I want to populate a Google map with my own (local) data. But there are a lot of objects on the map already, plus my own markers makes it so busy and confusing for user. I wonder how I can start with an almost empty map with only names of places. I have searched for that but I can't find any configuration on google map which makes it empty. I appreciate any suggestions.

I am working on a Geolocation application in which I want to populate a Google map with my own (local) data. But there are a lot of objects on the map already, plus my own markers makes it so busy and confusing for user. I wonder how I can start with an almost empty map with only names of places. I have searched for that but I can't find any configuration on google map which makes it empty. I appreciate any suggestions.

Share Improve this question edited Jun 4, 2015 at 8:36 Jeremy Thille 26.4k12 gold badges47 silver badges64 bronze badges asked Jun 4, 2015 at 8:32 Behnam EsmailiBehnam Esmaili 5,9676 gold badges34 silver badges64 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

You can use Styled Maps to control which kinds of features are displayed on a map you build with the JavaScript Maps API.

Start by experimenting with the Styled Maps Wizard until you get the effect you want, then use the Show JSON button to get the data object you can use with the Styled Maps API.

For example, I used the Wizard to turn off all features and then turn on only Roads/Labels. This was the resulting data:

[
  {
    "stylers": [
      { "visibility": "off" }
    ]
  },{
    "featureType": "road",
    "elementType": "labels",
    "stylers": [
      { "visibility": "on" }
    ]
  }
]

You can copy that into code like this simple styled map example.

Here's a fiddle with the above styles so you can experiment further.

var map = new google.maps.Map(document.getElementById('map-canvas'))

Can be found on the tutorial page.

发布评论

评论列表(0)

  1. 暂无评论