Google Map API 3 + WMS

后端 未结 2 1049
一向
一向 2021-01-31 00:36

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

2条回答
  •  轮回少年
    2021-01-31 01:34

    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!

提交回复
热议问题