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.
2 Answers
Reset to default 4You 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.