Google Maps API v3不使用多边形,突出显示国家边界 [英] Google Maps API v3 Highlight Country Border without using Polygons

查看:126
本文介绍了Google Maps API v3不使用多边形,突出显示国家边界的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要突出一个国家的边界​​ - 比方说瑞士。我已经用FusionTablesLayer实现了它,例如:


$ b

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



绘制的边框太直

p>

是否有可能使用某种搜索请求,因为如果我访问Google地图并搜索瑞士,则国家边界以浅粉色突出显示。这已经满足了我的要求。请参阅地图



在此先感谢

解决方案

正如我在评论中所说,至少在我们说话的时候这个API是不可用的。



尽管可以做两件事:


  1. 检出


  2. 订阅此功能请求

希望这有助于您!


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

解决方案

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!

这篇关于Google Maps API v3不使用多边形,突出显示国家边界的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆