PHP - Problema con pagina y Google Maps.

 
Vista:
sin imagen de perfil

Problema con pagina y Google Maps.

Publicado por Yhosimar (1 intervención) el 30/04/2013 08:58:47
Tengo un problema con una pagina que me encargaron par auna tesis, bueno la funcion de la pagina debe ser la siguiente primero que nada el mapa debe solo mostrar un marcador asi sean 100 veces que se seleccione un lugar dle mapa, pro siempre que le doy click aparece uno nuevamente, espero su ayuda pronto gracias.

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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
      html { height: 50% }
      body { height: 50%; margin: 0; padding: 0 }
      #map_canvas { height: 50% }
    </style>
    <script type="text/javascript"
	src="http://maps.googleapis.com/maps/api/js?key=AIzaSyAjd0SFbcrvZ1K926SzkZgmfR_9NPhp6UU&sensor=false">
	</script>
 
 
    <script type="text/javascript">
 
	var punto;
	var marcador;
	var map;
 
	function initialize()
	{
        var mapOptions =
		{
          center: new google.maps.LatLng(18.111414,-94.039798),
          zoom: 15,
          mapTypeId: google.maps.MapTypeId.HYBRID
		}
       var map = new google.maps.Map(document.getElementById("map_canvas"),
            mapOptions);
 
  google.maps.event.addListener(map, 'click', function(e)
  {
	  placeMarker(e.latLng, map);
	 punto= e.latLng,map;
  });
  }
 
	function placeMarker(position, map)
	{
	center: new google.maps.LatLng(position.Lat,position.Lng)
    var marker = new google.maps.Marker
  ({
    position: position,
    map: map,
	title: "Trabajo",
	icon: 'http://google-maps-icons.googlecode.com/files/workoffice.png'
  });
  map.panTo(position);
 document.getElementById("longitud").value=position.lng();
 document.getElementById("latitud").value=position.lat();
}
/*
google.maps.event.addDomListener(window, 'load', initialize);*/
    </script>
</head>
 
<body onload="initialize()" onunload="GUnload()">
<p><strong>Geolocalizacion de Egresados</strong></p>
<form name="form1" method="post" action="">
 
<table width="313" border="0">
  <tr>
    <td width="95"><strong>Matricula:</strong></td>
    <td width="208"><label for="matricula"></label>
      <input type="text" name="matricula" id="matricula"></td>
  </tr>
</table>
 
<p>
  <input type="submit" name="Buscar" id="Buscar" value="Buscar">
</p>
<table width="405" border="0">
  <tr>
    <td width="159"><strong>Nombre:</strong></td>
    <td width="207"><label for="nombre"></label>
      <input type="text" name="nombre" id="nombre"></td>
  </tr>
  <tr>
    <td><strong>Trabajas</strong></td>
    <td><label for="trabaja"></label>
      <select name="trabaja" size="1" id="trabaja">
        <option>SI</option>
        <option>NO</option>
      </select></td>
  </tr>
  <tr>
    <td><strong>Domicilio de Trabajo</strong>:</td>
    <td><label for="domicilio_trabajo"></label>
      <textarea name="domicilio_trabajo" id="domicilio_trabajo" cols=35 rows=3></textarea></td>
  </tr>
</table>
<p>&nbsp;</p>
</form>
<p><strong>Selecciona la Ubicacion de tu Trabajo.</strong><br />
</p>
<div id="map_canvas" style="width:500px; height:400px; border:#999999 1px solid;"></div>
<p><br />
  <strong>Longitud: </strong>
  <input type="text" id="longitud" readonly/>
</p>
<p><br />
  <strong>Latitud:</strong>
  <input type="text" id="latitud" readonly/>
</p>
<p><strong>Estado Actual:</strong>
<textarea name="Estado" id="Estado" cols=35 rows=3 ></textarea>
</p>
<p><br />
</p>
 
</body>
</html>
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
sin imagen de perfil

Problema con pagina y Google Maps.

Publicado por Ricardo Jesus (3 intervenciones) el 02/05/2013 06:19:48
Muy sencillo, una puedes incluir una variable de control de javascript

var yahecho = 0;

en la parte de google.maps.event.addListener(map, 'click', function(e) {

1
2
3
4
5
6
7
if(yahecho==0)
{
='editor_indent'>yahecho = 1;
='editor_indent'>placeMarker(e.latLng, map);
='editor_indent'>punto= e.latLng,map; });
 
}


}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar