在Google地图中突出显示整个国家 [英] Highlight whole countries in Google Maps
问题描述
我对Google地图有一个普遍的疑问。我想只为德国使用Google地图,但当然也会显示邻居国家。德国的边界很少见。
有没有可能淡化其他的,没有使用过的国家?
我可以使用public World Country Boundaries.kml Fusion Table。
您需要将其添加为 Fusion Table Layer 到您的地图。
首先初始化一张缩小的地图,居中显示,以便我们可以看到大多数国家:
var map = new google.maps.Map(document.getElementById('map-canvas'),{
center:new google.maps.LatLng(30,0),
zoom:2,
mapTypeId:google.maps.MapTypeId.ROADMAP
});
接下来添加 FusionTablesLayer
:
var world_geometry = new google.maps.FusionTablesLayer({
query:{
select:'geometry',
from:'1N2LBk4JHwWpOY4d9fobIn27lfnZ5MDy-NoqqRpk'
},
map:map,
suppressInfoWindows:true
});
看起来像这样:
< img src =https://i.stack.imgur.com/gvTR6.pngalt =所有国家>
关于:
有没有可能淡出其他未使用的国家?
如果您查看 Fusion Table ,你会看到 ISO_2DIGIT
。我们可以通过向 FusionTablesLayer
传递其中
条件来过滤这些条件,例如:
查询:{
select:'geometry',
from:'1N2LBk4JHwWpOY4d9fobIn27lfnZ5MDy-NoqqRpk',
其中:ISO_2DIGIT IN ('US','GB','DE')
},
给:
I have a general question about Google Maps. I want to use Google Maps just for germany, but of course the neighbor countries are shown as well. The border of germany is rarely visible.
Is there a possibility to fade out the other, not used countries?
I was able to do this using the public World Country Boundaries.kml Fusion Table.
You'll need to add it as a Fusion Table Layer to your map.
Firstly initialize a map zoomed out right out, centered so we can see most countries:
var map = new google.maps.Map(document.getElementById('map-canvas'), {
center: new google.maps.LatLng(30,0),
zoom: 2,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
Next add the FusionTablesLayer
:
var world_geometry = new google.maps.FusionTablesLayer({
query: {
select: 'geometry',
from: '1N2LBk4JHwWpOY4d9fobIn27lfnZ5MDy-NoqqRpk'
},
map: map,
suppressInfoWindows: true
});
That looks like this:
With regard to:
Is there a possibility to fade out the other, not used countries?
If you look at the Fusion Table you'll see there are columns for Name
and ISO_2DIGIT
. We can filter on these by passing a where
condition to the FusionTablesLayer
, e.g:
query: {
select: 'geometry',
from: '1N2LBk4JHwWpOY4d9fobIn27lfnZ5MDy-NoqqRpk',
where: "ISO_2DIGIT IN ('US', 'GB', 'DE')"
},
To give:
这篇关于在Google地图中突出显示整个国家的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!