0

我一直在使用谷歌地图 api,我需要根据我的理解显示标准叠加层,显示“如何从这里到达”、“到这里”、“在此处应用缩放”等的地址和链接。

我得到了这样的叠加层,但它不是标准的,我可以自定义它...有没有办法插入标准叠加层,如上所述?

这是我插入自定义叠加层的代码

        var marker = new GMarker(point);  // Create the marker
        map.addOverlay(marker);           // And add it to the map

        // And open some infowindow, with some HTML text in it
        marker.openInfoWindowHtml(
    'This is my test!!!, <strong>test </strong>'
    );

任何帮助真的很受欢迎

谢谢

4

1 回答 1

0

据我所知,没有标准的覆盖。这是有帮助的代码。您可以根据需要通过更改info参数来添加功能。

if( GBrowserIsCompatible() ) {
    walkmap = new GMap2( document.getElementById( "walkmap" ) ) ;
    walkmap.setCenter( new GLatLng( 11.22,-33.44 ), 16 ) ;
    walkmap.setMapType( G_HYBRID_MAP ) ;

    var baseIcon = new GIcon();
    baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
    baseIcon.iconSize = new GSize(20, 34);
    baseIcon.shadowSize = new GSize(37, 34);
    baseIcon.iconAnchor = new GPoint(9, 34);
    baseIcon.infoWindowAnchor = new GPoint(9, 34);
    baseIcon.infoShadowAnchor = new GPoint(18, 25);

    var Marker = function( point, info, image ) {
        var point = point ;
        var icon = new GIcon( baseIcon ) ;
        icon.image = image ;
        var marker = new GMarker( point, icon ) ;
        marker.info = info ;
        marker.showInfo = function() {
            this.openInfoWindowHtml( this.info ) ;
        }
        GEvent.addListener( marker, "click", function() {
            marker.showInfo() ;
        });
        walkmap.addOverlay( marker ) ;
        return marker ;
    }

    new Marker( new GLatLng( 11.22,-33.44 ), "My marker", "http://www.google.com/intl/en_us/mapfiles/dd-start.png" ) ;
}
于 2010-01-18T15:39:13.987 回答