1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Highlight Places By Their Category

Discussion in 'Google API' started by Alex94, Jan 21, 2013.

  1. #1
    Hi, i have this code, which just shows a Google Map with google maps APIv3 and highlights a place in italy, is there a way to show maybe all the pubs in italy on the map?

    <html>
    <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
     
    <title>Google Maps</title>
     
    <style type="text/css">
    html, body { margin:0; padding:0; width:100%; height:100%; }
    body { background:#FFFFFF; color:#000000; font-family:Arial, Helvetica, sans-serif; font-size:12px; line-height:150%; text-align:center;}
    #map { width:100%; height:100%; }
    #tooltip { padding:10px; text-align:left; }
    #tooltip p,  #tooltip img { float:left; display:inline; padding:0; margin:0 10px 0 0; }
    </style>
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript">
    var initialize = function() {
        var latlng = new google.maps.LatLng(42.745334,12.738430);
        var options = {
            zoom: 12,
            center: latlng,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        var map = new google.maps.Map(document.getElementById('map'), options);
        var marker = new google.maps.Marker(
            {
                position: latlng,
                map: map,
                icon: 'http://google-maps-icons.googlecode.com/files/country.png',
                flat: true
            }
        );
        var tooltip = '<div id="tooltip">'+
            '<img src="spoleto.jpg" alt="Spoleto">'+
            '<p><strong>Comune di Spoleto</strong><br>'+
            'cap: 06049<br>'+
            'provincia: Perugia<br>'+
            'nazione. Italia</p>'+
            '</div>';
        var infowindow = new google.maps.InfoWindow({
            content: tooltip
        });
        google.maps.event.addListener(marker, 'click', function() {
            infowindow.open(map,marker);
        });
    }
    window.onload = initialize;
    </script>
    </head>
    <body>
    <div id="map"></div>
    </body>
    </html>
    HTML:
     
    Last edited: Jan 21, 2013
    Alex94, Jan 21, 2013 IP