PDA

Ver la Versión Completa : Google Maps y OpenStreetMaps


marcial
09-12-2015, 21:31:48
Hola a todos:

Trabajo con D5 y tengo el siguiente problema:

Tengo una aplicación que, usando Google Maps V3, me posiciona una marca en la dirección de por ejemplo un cliente. Esto lo hace perfectamente, pero lo que no consigo es que cuando arrastro el mapa hacia cualquier lado, éste se vuelva a repintar; es decir, que el mapa conforme me lo llevo p.ej. hacia abajo, por la parte de arriba no se vuelve a dibujar, es como si fuera una imagen del tamaño del contenedor (WebBrowser) que se arrastra pero no se repinta.

Lo mismo lo intento con OpenStreetMap y el mapa SI vuelve a repintar cuando se arrastra.

Os agradecería me dijerais si es que Google Maps no puede hacerlo o es que no lo estoy haciendo bien.

Muchas gracias por emplear vuestro tiempo en ayudarme.

Casimiro Notevi
10-12-2015, 00:22:46
¿Y cómo lo haces? :)

Neftali [Germán.Estévez]
10-12-2015, 09:49:02
Lo dicho.
Todo depende de cómo estés visualizando el mapa.

Google maps, posee un modo de imágenes estáticas, es decir, en que en lugar de un mapa, cargas un trozo de mapa, como si fuera una imagen.
¿No estarás utilizando ese modo?

marcial
10-12-2015, 10:40:24
Vaya, eso de las imágenes estaticas no lo sabia. El script es este:


HTMLStr: String =
'<html> '+
'<head> '+
'<meta name="viewport" content="initial-scale=1.0, user-scalable=yes" /> '+
'<script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3&sensor=true"></script> '+
'<script type="text/javascript"> '+
''+
' var geocoder; '+
' var map; '+
' var markersArray = [];'+
' var wait = false;'+
' var lat;'+
' var lang;'+
' var LatLng;'+
''+
' function initialize() { '+
' geocoder = new google.maps.Geocoder();'+
' var myOptions = { '+
' zoom: 17, '+
' draggable: true, '+
' mapTypeId: google.maps.MapTypeId.ROADMAP '+
' }; '+ ' map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); '+
' } '+
''+
' function PutMarkerDireccion(address) { '+
' if (geocoder) {'+
' geocoder.geocode( { address: address}, function(results, status) { '+
' var infowindow = new google.maps.InfoWindow({'+
' Content: "<br>" +address+ "<br>" + " Cordenadas: " +results[0].geometry.location.lat() +" "+results[0].geometry.location.lng()});'+

' if (status == google.maps.GeocoderStatus.OK) {'+
' map.setCenter(results[0].geometry.location);'+

' var marker = new google.maps.Marker({'+
' map: map,'+
' position: results[0].geometry.location,'+
' Title: Nombre});'+
' markersArray.push(marker);'+
' wait = true;'+
' setTimeout("wait = true", 2000);'+

' } else if (status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT) {'+
' wait = true;'+
' setTimeout("wait = true", 2000);'+
' var marker = new google.maps.Marker({'+
' map: map,'+
' position: results[0].geometry.location.lat(),'+
' position: results[0].geometry.location.lng(),'+
' Title: Nombre});'+
' markersArray.push(marker);'+

' } else if (status == google.maps.GeocoderStatus.ZERO_RESULTS) {'+
' wait = true;'+
' setTimeout("wait = true", 1000);'+

' } else {'+
' alert("Geocode was not successful for the following reason: " + status);'+
' }'+
' });'+
' }'+
' }'+
''+
''+
'function ClearMarkers() { '+
' if (markersArray) { '+
' for (i in markersArray) { '+
' markersArray[i].setMap(null); '+
' } '+
' } '+
'} '+
''+
''+'</script> '+
'</head> '+
'<body onload="initialize()"> '+
' <div id="map_canvas" style="width:100%; height:100%"></div> '+
' <div id="latlong"> '+
' <input type="hidden" id="latValue" >'+
' <input type="hidden" id="lngValue" >'+

'</body> '+
'</html> ';



y la llamada:

HTMLWindow2.execScript(Format('PutMarkerDireccion(%s)',[QuotedStr(address)]), 'JavaScript');