在Google街景视图上标记建筑物/物体

时间:2013-11-04 05:52:34

标签: google-maps view overlay


  我想在我的网页上的Google街景视图上标记(或标记)建筑物(或标记),我在文章“I want to add popover/overlay/hotspot on the streetview of google map in android”中找到适用于Android APP(JavaScript / WebView)的解决方案。但解决方案不适用于网页。

网页是否有可用的解决方案?

提前谢谢大家!

1 个答案:

答案 0 :(得分:0)

使用google.maps.Marker类

function initialize() {

        var hongkongolympic = new google.maps.LatLng(22.320701, 114.160688);

        var mapOptions = {
                center: hongkongolympic,
                zoom: 14,
                mapTypeId: google.maps.MapTypeId.ROADMAP
        };

        var map = new google.maps.Map(
                document.getElementById('map-canvas'), mapOptions);

        var marker = new google.maps.Marker({
                position: hongkongolympic,
                map: map,
                title: "Hello World!"
        });

        var panoramaOptions = {
                position: hongkongolympic,
                pov: {
                        heading: 150,
                        pitch: 10
                }
        };

        var panorama = new google.maps.StreetViewPanorama(document.getElementById('pano'), panoramaOptions);

        var marker2 = new google.maps.Marker({
                position: hongkongolympic,
                map: panorama
        });

}

google.maps.event.addDomListener(window, 'load', initialize);