Visualizzazione dei risultati da 1 a 4 su 4

Discussione: Google Maps dinamico

  1. #1

    Google Maps dinamico

    Ciao a tutti,
    volevo come fare (le api già esistenti nn le riesco proprio a capire ) per "creare" dinamicamente una mappa google. Ho un db con regioni, città e provincia.
    A seconda delle combinazioni, voglio che la mappa abbia in ingresso la terna di valori e che mi restituisca la visuale completa di quella provincia.
    Potete consigliarmi qualcosa???
    help!

  2. #2
    esempio:

    codice:
    // JavaScript Document
    
    var geocoder;
    
    function mapInitGeocoder(){
    	if(GBrowserIsCompatible()){
    		geocoder = new GClientGeocoder();	
    	}
    }
    
    function mapShowPoint(mapID, lat, long, label, zoom){
    	if(GBrowserIsCompatible()){
    		var map = new GMap2($(mapID));
    		var point = new GLatLng(lat, long);
            map.setCenter(point, zoom);
    		var marker = new GMarker(point);
    		map.addOverlay(marker);
    		marker.openInfoWindowHtml(label);
    		map.setUIToDefault();
    	}
    }
    
    function mapShowAddress(mapID, address, label, zoom) {
    	if(!geocoder)
    		mapInitGeocoder();
    
    	if (geocoder && GBrowserIsCompatible()) {
    		geocoder.getLatLng(
    			address,
    			function(point) {
    				if (!point) {
    					alert(address + " not found");
    				} else {
    					var map = new GMap2($(mapID));
    					map.setCenter(point, 13);
    					var marker = new GMarker(point);
    					map.addOverlay(marker);
    					marker.openInfoWindowHtml(label);
    					
    					var c1 = new GLargeMapControl3D();
    					var topRight = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10,10));
    					var c2 = new GMapTypeControl();
    					var topLeft = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50,2));
    					map.addControl(c1,topRight);
    					map.addControl(c2,topLeft);
    					
    					
    				}
    			}
    		);
    	}
    }
    usage:

    codice:
    <div id="mappa"></div>
    <script language="javascript">
    mapShowAddress('mappa', 'Roma,Italia,Via del Corso', 'esempio di descrizione
    in html', 13)
    </script>
    IP-PBX management: http://www.easypbx.it

    Old account: 2126 messages
    Oldest account: 3559 messages

  3. #3
    non ci riesco a far vedere la mappa

  4. #4
    Originariamente inviato da facciadiletame
    non ci riesco a far vedere la mappa
    ce l'hai la chiave di google maps e fai l'include del file javascript di google maps?
    IP-PBX management: http://www.easypbx.it

    Old account: 2126 messages
    Oldest account: 3559 messages

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.