Google Maps API v3 Highlight Country Border without using Polygons

Issue

I need to highlight the border of a country – let’s say Switzerland. I achieved it with already with FusionTablesLayer like:

        var layer = new google.maps.FusionTablesLayer({
                    query: {
                        select: 'geometry',
                        from: '1N2LBk4JHwWpOY4d9fobIn27lfnZ5MDy-NoqqRpk',
                        where: "ISO_2DIGIT IN ('CH')"
                    },
                    styles: [
                        {
                            polygonOptions: {
                                strokeColor: "#FF0000",
                                fillOpacity: "0"
                            }
                        }
                    ]
                });

                layer.setMap(map);

The problem hereby is, that the drawn border is too straight

Screenshot

Is there any possibility to use some kind of search request, because if I go to Google Maps and search for Switzerland the country borders are highlighted in a light pink. This would already fullfil my requirements. See Maps

Thanks in advance

Solution

As I said in my comment, this is not available through the API (at least at the time we speak).

You can do 2 things though:

  1. check out this answer where I give a complete solution on how to overlay polygons as country boundaries and provide a complete world data set.

  2. Subscribe to this feature request that is exactly what you are looking for.

Hope this helps!

Note: this answer is still valid in 05.2022

Answered By – MrUpsidown

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published