Google Map API 3 + WMS [英] Google Map API 3 + WMS

查看:240
本文介绍了Google Map API 3 + WMS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能给我最好的主意,如何把WMS图层放在谷歌地图上我有很多图层和很多样式。我在StackOverflow上研究了很多Q和A,但我没有理解如何管理多个样式和图层。我想把我的JQuery代码放进去。

解决方案

这里有一个很好的例子: http://www.sumbera.com/lab/GoogleV3/tiledWMSoverlayGoogleV3.htm



这里有两种图层:


  1. 底层的底层
  2. >
  3. 覆盖半透明图层,其高于所有其他图层

(注意:在上例中,它们使用WMS仅适用于案例2,但您当然也可以将它用于1,因为接口(对象 google.maps.ImageMapType )对于两者都是相同的) p>

基本上,要添加您使用的基础图层:

  map。 mapTypes.set('OSM',new google.maps.ImageMapType({...})); 

添加您使用的覆盖图层:

  map.overlayMapTypes.push(new google.maps.ImageMapType({...})); 

要为地图类型控制添加图层,您可以在创建地图时使用选项:

  mapTypeControlOptions:{
mapTypeIds:[
'OSM',
google.maps.MapTypeId.ROADMAP,
google.maps.MapTypeId.SATELLITE,
google.maps.MapTypeId.HYBRID,
google.maps.MapTypeId.TERRAIN
],
style:google.maps.MapTypeControlStyle .DROPDOWN_MENU
}

上面的例子说明了这一点。至于WMS图层的样式,这非常复杂,我也在这里关于这个问题。祝你好运!


Can somebody give me best idea, how to put WMS layer over Google map I have so many layers and so many styles. I research on so many Q and A at StackOverflow, but I didn't get the point about how to manage multiple styles and layers. I would like to put into my JQuery code.

解决方案

There is a great example on this here: http://www.sumbera.com/lab/GoogleV3/tiledWMSoverlayGoogleV3.htm

Here you have 2 kinds of layers:

  1. base layer which is in the bottom
  2. overlayed semi-transparent layer which is above all other layers

(note: in the above example they use WMS just for case 2, but you can of course use it also for 1, as the interface (object google.maps.ImageMapType) is the same for both)

Basically, to add "base layers" you use:

map.mapTypes.set('OSM', new google.maps.ImageMapType({ ... }));

To add overlayed layer you use:

map.overlayMapTypes.push(new google.maps.ImageMapType({ ... }));

To add layers to map type control you use option when creating the map:

mapTypeControlOptions: {
    mapTypeIds: [
        'OSM', 
        google.maps.MapTypeId.ROADMAP, 
        google.maps.MapTypeId.SATELLITE, 
        google.maps.MapTypeId.HYBRID, 
        google.maps.MapTypeId.TERRAIN
    ],
    style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
}

The above example illustrates this greatly. As for the styling of the WMS layers, this is pretty complex, I also put a question about this here. Good luck!

这篇关于Google Map API 3 + WMS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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