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
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
To achieve this, you will basically need to look for the coordinates of the state or country on GADM. Once you have them, draw a shape on the Google Maps with the Polygon object providing an array with all the coordinates that play basically as borders of the place that you want to highlight.
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:
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.
Subscribe to this feature request that is exactly what you are looking for.
Hope this helps!
Note: this answer is still valid in 06.2021
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With