Google Maps Api V3 - Country or City Style

I'm trying to make a map, only for the selected area, say, a country and get rid of some labels and things that are on the map. I found a style wizard: http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html But my question is: if you can somehow hide small cities or other countries than mine the chosen one?

I know that I can hide all cities at once or hide borders, but I am curious if I can leave the main cities visible and, for example, gray other countries than the USA, or do I have to manually create the largest polygon everywhere except the USA? oo

+6
source share
1 answer

Unfortunately, the Google Maps API does not offer a way to selectively hide shortcuts in an area. You can only remove tags for the entire map in several categories - for example. using a MapTypeStyle containing:

{ featureType: "administrative.country", elementType: "labels", stylers: [ { visibility: "off" } ] } 

hides labels with country names.

To hide the area, you must create your own overlay β€” some type of polygon or map overlay.

If you want to display only the area of ​​the map, perhaps it is also a good idea to limit the visible area of ​​the map .

+12
source

Source: https://habr.com/ru/post/898974/


All Articles