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
'----------------------------------------------------------------------------------------------------------------------------------