Visualizzazione dei risultati da 1 a 9 su 9

Discussione: problema google map

  1. #1
    Utente di HTML.it
    Registrato dal
    Apr 2001
    Messaggi
    84

    problema google map

    Sono riuscito a creare i marker sulla mappa prendendo le coordinate dal database, volendo fare una specie di legenda della mappa vorrei stampare a video l'elenco dei nomi associati ad ogni marker e cliccandoci sopra visualizzare il contenuto del marker relativo sulla mappa.
    non riesco a capire come fare.
    qui c'è la mappa in questione.
    mappa

    qualcuna ha qualche dritta su come posso fare o dove trovare uno scriptino da adattare?

    Grazie in anticipo

  2. #2
    Utente di HTML.it
    Registrato dal
    Apr 2001
    Messaggi
    84
    nessuno sa cosa fare?

  3. #3
    Utente di HTML.it
    Registrato dal
    Apr 2001
    Messaggi
    84

    un ci credo che nessuno sappia niente.
    che forse ho sbagliato sezione?
    se si potreste per favore spostarmi, oppure apro un altro 3d.

  4. #4
    Nel db hai na tabella coi campi
    titoloMarker, coordinateMarker?
    Mi posti un esempio di contenuto di questa tua tabella?
    Mi fai vedere come costruisci il link per puntare a maps di google e far apparire il marker sulla mappa?

  5. #5
    Utente di HTML.it
    Registrato dal
    Apr 2001
    Messaggi
    84
    ho allegato una immagine della struttura della tabella

    queste sono le funzioni di creazione mappa e popolamento markers

    per la funzione "inseriscimarkers" la query è semplicemente "Select * From markers"

    passo la query come parametro cosi posso eventualmente selezionare i record in base all' anno o al nome utente o altra cosa...


    codice:
    '----------------------------------------------------------------------------------------------------------------------------------
    '----------------------------------------------------------------------------------------------------------------------------------
    '										Funzione per creare la mappa GoogleMap
    '----------------------------------------------------------------------------------------------------------------------------------
    '----------------------------------------------------------------------------------------------------------------------------------
    
    Function creamappa (posx,posy,zoom)
    w "//----------------------------------------------------------------------------------------------------"&vbNewLine
    w "//			Creazione della mappa"&vbNewLine
    w "//----------------------------------------------------------------------------------------------------"&vbNewLine
    w "  var map = new GMap2(document.getElementById(""map""));"&vbNewLine
    w vbtab&"map.addControl(new GScaleControl());"&vbNewLine
    If CBool(maptyp) Then
    w vbtab&"map.addControl(new GMapTypeControl());"&vbNewLine
    End If
    	Select case extcontrol
    		Case 1
    		w vbtab&"map.addControl(new GSmallZoomControl());"&vbNewLine
    		Case 2
    		w vbtab&"map.addControl(new GSmallMapControl());"&vbNewLine
    		Case 3
    		w vbtab&"map.addControl(new GLargeMapControl());"&vbNewLine
    	End Select
    		w vbtab&"map.enableDoubleClickZoom();"&vbNewLine
    		w vbtab&"map.enableContinuousZoom();"&vbNewLine
    	'	w vbtab&"map.enableScrollWheelZoom();"&vbNewLine
    If CBool(minimappa) Then
    w vbtab&"map.addControl(new GOverviewMapControl());"&vbNewLine
    End If
    w "// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"&vbNewLine
    '                                      longitudine                 latitudine                 zoom
    w vbtab&"map.setCenter(new GLatLng("&Replace(posx,",",".")&", "&Replace(posy,",",".")&"), "&Cint(zoom)&");"&vbNewLine
    w "//----------------------------------------------------------------------------------------------------"&vbNewLine
    End Function ' crea mappa
    
    '----------------------------------------------------------------------------------------------------------------------------------
    
    '----------------------------------------------------------------------------------------------------------------------------------
    '----------------------------------------------------------------------------------------------------------------------------------
    '										Funzione per inserire i Markers di GoogleMap
    '----------------------------------------------------------------------------------------------------------------------------------
    '----------------------------------------------------------------------------------------------------------------------------------
    Function inseriscimarkers (query)
    If CBool(marker) Then
    
    w "//----------------------------------------------------------------------------------------------------"&vbNewLine
    w "//			Inserimento dei Markers"&vbNewLine
    w "//----------------------------------------------------------------------------------------------------"&vbNewLine
    w "function createMarker(point, text, id, titololink) {"&vbNewLine
    	If CBool(markertitolo) Then
    	w "// Crea l'icona base per tutti i markers specificando ombra, dimensioni, tipo di immagine, ecc..."&vbNewLine
    	w "//----------------------------------------------------------------------------------------------------"&vbNewLine
    	w vbtab&"var baseIcon = new GIcon();"&vbNewLine
    	w vbtab&"baseIcon.shadow = ""./Immagini/googlemaps/shadow50.png"";"&vbNewLine
    	w vbtab&"baseIcon.iconSize = new GSize(20, 34);"&vbNewLine
    	w vbtab&"baseIcon.shadowSize = new GSize(37, 34);"&vbNewLine
    	w vbtab&"baseIcon.iconAnchor = new GPoint(9, 34);"&vbNewLine
    	w vbtab&"baseIcon.infoWindowAnchor = new GPoint(9, 2);"&vbNewLine
    	w vbtab&"baseIcon.infoShadowAnchor = new GPoint(18, 25);"&vbNewLine
    	w "// Carica il marker personalizzato"&vbNewLine
    	w "//----------------------------------------------------------------------------------------------------"&vbNewLine
    	w vbtab&"var icon = new GIcon(baseIcon);"&vbNewLine
    	w vbtab&"icon.image = ""./Immagini/googlemaps/marker_""+id+"".png"";"&vbNewLine
    	w "// inserisce il marker nel punto specificato"&vbNewLine
    	w "//----------------------------------------------------------------------------------------------------"&vbNewLine
    	w vbtab&"var marker = new GMarker(point, icon);"&vbNewLine
    	Else
    	w "// inserisce il marker nel punto specificato"&vbNewLine
    	w "//----------------------------------------------------------------------------------------------------"&vbNewLine
    	w vbtab&"var marker = new GMarker(point, {title:titololink});"&vbNewLine
    	End If ' markertitolo'
    w vbtab&"GEvent.addListener(marker, ""click"", function() {"&vbNewLine
    w vbtab&"marker.openInfoWindowHtml(text);"&vbNewLine
    w vbtab&"});"&vbNewLine
    w vbtab&"return marker;"&vbNewLine
    w vbtab&"}"&vbNewLine
    
    Call creamarker (query)
    
    End If ' marker
    End Function ' inseriscimarkers
    
    '----------------------------------------------------------------------------------------------------------------------------------
    
    '----------------------------------------------------------------------------------------------------------------------------------
    '----------------------------------------------------------------------------------------------------------------------------------
    '										Funzione per creare i Markers di GoogleMap
    '----------------------------------------------------------------------------------------------------------------------------------
    '----------------------------------------------------------------------------------------------------------------------------------
    Function creamarker (query)
    If Session("marker") = "" Then
    Session("marker") = ""
    Dim id,testo,titolo,links
    apridb
    aprirs rs,query,3
    w "//----------------------------------------------------------------------------------------------------"&vbNewLine
    w "//			Creazione dei Markers"&vbNewLine
    	Do While Not rs.eof
    		links = ""
    		If Len(rs("num")) = 1 Then
    		id = "0"&rs("num")
    		Else
    		id = rs("num")
    		End If
    
    	If rs("perspage") <> 0 Or rs("pubemail") <> "" Or rs("www") <> "" Then
    	links =			"<table border=""0"" cellpadding=""5"" cellspacing=""0"">"
    	links = links&	"  <tr>"
    		If rs("perspage") <> 0 Then
    		links = links&	"    <td align=""center"">Biografia</td>"
    		Else
    			If rs("pubemail") <> "" Then
    			links = links&	"    <td align=""center"">mail</td>"
    			End If
    			If rs("www") <> "" Then
    			links = links&	"    <td align=""center"">Sito personale</td>"
    			End If
    		End If
    	links = links&	"  </tr>"
    	links = links&	"</table>"
    	End If
    
    	titolo = "Click per aprire"
    	testo =		"<div style=""width: 300px; padding-right: 10px"">"&_
    					javastring (rs("info"))&_
    					links&_
    				"</div>"
    w "//----------------------------------------------------------------------------------------------------"&vbNewLine
    	w vbtab&"var point = new GLatLng("&rs("long")&", "&rs("lat")&");"&vbNewLine
    	Session("marker") = Session("marker")&"var point = new GLatLng("&rs("long")&", "&rs("lat")&");"
    	w vbtab&"map.addOverlay(createMarker(point, '"&testo&"', '"&id&"', '"&titolo&"'));"&vbNewLine
    	Session("marker") = Session("marker")&"map.addOverlay(createMarker(point, '"&testo&"', '"&id&"', '"&titolo&"'));"
    w "//----------------------------------------------------------------------------------------------------"&vbNewLine
    	rs.MoveNext
    	Loop
    chiudirs rs
    chiudidb
    Else
    w Session("marker")
    End If
    End Function ' creamarker
    
    '----------------------------------------------------------------------------------------------------------------------------------
    Immagini allegate Immagini allegate

  6. #6
    E' JScript.
    Mi spiace. Non conosco JScript.

  7. #7
    Utente di HTML.it
    Registrato dal
    Apr 2001
    Messaggi
    84
    in realtà è asp vbscript

    ovviamente stampo nella pagina codice javascript perche le api di google funzionano anche cosi.


    cmq
    dove posso postare la domanda nel forum javascript?

    questo è il risultato dell'esecuzione di quello script sopra:

    codice:
    <script type="text/javascript">
    
    	if (GBrowserIsCompatible()) {
    		//----------------------------------------------------------------------------------------------------
    //			Creazione della mappa
    //----------------------------------------------------------------------------------------------------
      var map = new GMap2(document.getElementById("map"));
    	map.addControl(new GScaleControl());
    	map.addControl(new GLargeMapControl());
    	map.enableDoubleClickZoom();
    	map.enableContinuousZoom();
    	map.addControl(new GOverviewMapControl());
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    	map.setCenter(new GLatLng(43.9335, 11.4724), 12);
    //----------------------------------------------------------------------------------------------------
    //----------------------------------------------------------------------------------------------------
    //			Inserimento dei Markers
    //----------------------------------------------------------------------------------------------------
    function createMarker(point, text, id, titololink) {
    // Crea l'icona base per tutti i markers specificando ombra, dimensioni, tipo di immagine, ecc...
    //----------------------------------------------------------------------------------------------------
    	var baseIcon = new GIcon();
    	baseIcon.shadow = "./Immagini/googlemaps/shadow50.png";
    	baseIcon.iconSize = new GSize(20, 34);
    	baseIcon.shadowSize = new GSize(37, 34);
    	baseIcon.iconAnchor = new GPoint(9, 34);
    	baseIcon.infoWindowAnchor = new GPoint(9, 2);
    	baseIcon.infoShadowAnchor = new GPoint(18, 25);
    // Carica il marker personalizzato
    //----------------------------------------------------------------------------------------------------
    	var icon = new GIcon(baseIcon);
    	icon.image = "./Immagini/googlemaps/marker_"+id+".png";
    // inserisce il marker nel punto specificato
    //----------------------------------------------------------------------------------------------------
    	var marker = new GMarker(point, icon);
    	GEvent.addListener(marker, "click", function() {
    	marker.openInfoWindowHtml(text);
    	});
    	return marker;
    	}
    //----------------------------------------------------------------------------------------------------
    //			Creazione dei Markers
    //----------------------------------------------------------------------------------------------------
    	var point = new GLatLng(43.93366047079528, 11.482000350952148);
    	map.addOverlay(createMarker(point, '<div style="width: 300px; padding-right: 10px">
    
    Paolo</p>  
    
    [img]/nuovo/content/Public//David.bmp[/img]</p><table border="0" cellpadding="5" cellspacing="0">  <tr>    <td align="center">Biografia</td>  </tr></table></div>', '01', 'Click per aprire'));
    //----------------------------------------------------------------------------------------------------
    //----------------------------------------------------------------------------------------------------
    	var point = new GLatLng(43.93622554802789, 11.475906372070312);
    	map.addOverlay(createMarker(point, '<div style="width: 300px; padding-right: 10px">
    
    mario rossi</p><table border="0" cellpadding="5" cellspacing="0">  <tr>    <td align="center">Sito personale</td>  </tr></table></div>', '02', 'Click per aprire'));
    //----------------------------------------------------------------------------------------------------
    
    	}
    	else {
    		alert("Spiacenti, le API di Google Maps non sono compatibili con questo browser");
    	}
    
    </script>

  8. #8
    Se fai un ciclo ed elenchi le voci della tabella e ci costruisci i collegamenti con marker che succede?

  9. #9
    Utente di HTML.it
    Registrato dal
    Apr 2001
    Messaggi
    84
    la domanda era proprio come faccio a creare un collegamento ad un marker della mappa da una scritta fuori dalla mappa per far comparire il fatidico fumetto relativo.

    non so come collegarmi al marker.
    come deve essere scritto sto benedetto link.

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 © 2026 vBulletin Solutions, Inc. All rights reserved.