JavaScript - Ayuda con markers en Google Maps V2

 
Vista:

Ayuda con markers en Google Maps V2

Publicado por Ayon (1 intervención) el 28/04/2012 23:21:18
Hola, estoy usando un mapa de google V2 para poner los markers desde una base de datos, necesito que el nombre se vea en todo momento, y la única solución que encontré es este código que genera un popup dentro del mapa.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<script type="text/javascript">
    document.write('<script type="text/javascript" src="popupmarker'+(document.location.search.indexOf('packed')>-1?'_packed':'')+'.js"><'+'/script>');
  </script>
 
<script type="text/javascript">
 
    //<![CDATA[
 
    var iconBlue = new GIcon();
    iconBlue.image = 'mm_20_blue.png';
    iconBlue.shadow = 'mm_20_shadow.png';
    iconBlue.iconSize = new GSize(12, 20);
    iconBlue.shadowSize = new GSize(22, 20);
    iconBlue.iconAnchor = new GPoint(6, 20);
    iconBlue.infoWindowAnchor = new GPoint(5, 1);
 
    var iconRed = new GIcon();
    iconRed.image = 'mm_20_red.png';
    iconRed.shadow = 'mm_20_shadow.png';
    iconRed.iconSize = new GSize(12, 20);
    iconRed.shadowSize = new GSize(22, 20);
    iconRed.iconAnchor = new GPoint(6, 20);
    iconRed.infoWindowAnchor = new GPoint(5, 1);
 
    var customIcons = [];
    customIcons["restaurant"] = iconBlue;
    customIcons["bar"] = iconRed;
 
    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(-27.366667, -70.333333), 5);
 
        // Change this depending on the name of your PHP file
        GDownloadUrl("phpsqlajax_genxml.php", function(data) {
          var xml = GXml.parse(data);
          var markers = xml.documentElement.getElementsByTagName("marker");
          for (var i = 0; i < markers.length; i++) {
            var name = markers[i].getAttribute("name");
 var opts = {
          text : "Volcan " + name
        };
 
        var marker = new PopupMarker(new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng"))), opts);
        map.addOverlay(marker);
            var address = markers[i].getAttribute("address");
            var type = markers[i].getAttribute("type");
 
            var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
                                    parseFloat(markers[i].getAttribute("lng")));
 
            var marker = createMarker(point, name, address, type);
            map.addOverlay(marker);
          }
        });
      }
    }
 
    function createMarker(point, name, address, type) {
      var marker = new GMarker(point, customIcons[type]);
      var html = "<b>Volcan " + name + "</b> <br/>" + "<p>Dispone de la siguiente infomacion:</p>" + address + "<li><a>Informacion General</a></li><li>Informacion Eruptiva Moderna</li><li>Vulcanologia Fisica</li><li>Geoquimica de Rocas</li><li>Geoquimica de Fluidos</li><li>Edades</li><li>Mapa geoligico</li><br><br/>";
      GEvent.addListener(marker, 'click', function() {
        marker.openInfoWindowHtml(html);
      });
      return marker;
    }
    //]]>
  </script>

http://a8.sphotos.ak.fbcdn.net/hphotos-ak-snc7/383552_3689161030241_1311680917_3501899_1206627315_n.jpg

El problema que tengo es q el marcador que se genera cuando hago el popupmarker no deja que se despliegue la ventana de infowindows del icono volcan (intente poniéndolo antes de que se generara el otro marcador pero solo aparece atrás el rojo (como se ve en la imagen del link), pero de todas maneras no abre el infowindows) como podría eliminar el icono rojo del otro marcador pero manteniendo el globo con el nombre. Muchas gracias

El popupmarker lo saque desde:
http://gmaps-utility-library-dev.googlecode.com/svn/tags/popupmarker/1.1/examples/simple.html
http://gmaps-utility-library-dev.googlecode.com/svn/tags/popupmarker/

No tengo mucho conocimiento pero lo necesito o si tienen otra alternativa para ponerle el nombre como salen los marcadores en el google earth, muchas gracias de antemano.
Ayôn
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder