views:

61

answers:

1

Hi there,

I have been using the google maps api and i need to display from what i understand is a standard overlay that displays the Address and links of "how to arrive from here here", "to here", "apply zoom here" etc.

I got the overlay working like this but its not standard, i can customize it... is there a way to insert the standard overlay as explained above?

Here is my code for inserting a custom overlay

        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>'
    );

Any help really appeciated

Thanks

A: 

As far as I know there is no standard overlay. Here's the code that'll help. You may add functionality by changing info parameter as desired.

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" ) ;
}
St.Woland
Thanks, but it gives me the error "baseIcon" is not defined.. Where is baseIcon defined??
mark smith
Check it out, I added some extra lines.
St.Woland
Thanks .. yes it now works without an error... but all it does it create a marker... and i have to click the marker and then a window pops up with the words "my marker"... i am going to take a ascreenshot of my old version that is working .. but its was done with a frame and passing in a url not the api.... 1 moment
mark smith
here is a screenshot of what i had... not using the api directly.... so i am trying to do the same using the api.. http://drop.io/x27nysw/asset/googlemaps-png
mark smith