javascript Google Maps API v3 在不使用多边形的情况下突出显示国家边界
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28964573/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Google Maps API v3 Highlight Country Border without using Polygons
提问by Baby Jesus
I need to highlight the border of a country - let's say Switzerland. I achieved it with already with FusionTablesLayer like:
我需要突出一个国家的边界 - 比如说瑞士。我已经使用 FusionTablesLayer 实现了它,例如:
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
提前致谢
采纳答案by MrUpsidown
As I said in my comment, this is not available through the API (at least at the time we speak).
正如我在评论中所说,这无法通过 API 获得(至少在我们发言时)。
You can do 2 things though:
你可以做两件事:
check out this answerwhere I give a complete solution on how to overlay polygons as country boundaries and provide a complete world data set.
Subscribe to this feature requestthat is exactly what you are looking for.
Hope this helps!
希望这可以帮助!