El código, que os dejo, debería ayudar a descargar la imagen que forman el mapa que vosotros estáis viendo.
Se necesita:
* activar los siguientes componentes: gb.qt4.webkit, gb.net y gb.net.curl;
* poner sobre el Form los siguientes objectos: un WebView y dos Button .
Hacer clic sobre el map, cuando aparece en WebView; despues presionar el Button1.
Private im As Image
Private myhttp As New HttpClient As "myhttp"
Private stringa As String
Private ind As New String[]
Private n As Byte
Private we As WebElement
Public Sub Form_Open()
Button1.Text = "Extraer\nlas imágenes"
Button1.Enabled = False
Button2.Text = "Borrar las imágenes\ndescargadas"
Button2.Enabled = False
im = New Image(WebView1.W, WebView1.H)
WebView1.Url = "http://www.openstreetmap.org/#map=5/41.656/14.150"
End
Public Sub WebView1_Load()
Print "Para iniciar la extracción de las imágenes,\nhaz clic en el mapa.\n"
End
Public Sub WebView1_MouseUp()
Dim wf As New WebFrame
n = 0
ind.Clear()
wf = WebView1.Frame
we = wf.Document
Print WebView1.Frame.Url
Print "\nPresionar la tecla "; Quote("Extraer las imágenes"); "."
Button1.Enabled = True
End
Public Sub Button1_Click()
Dim i1, i2 As Integer
Dim s2 As String
Dim s As String = we.HTML
While True
i1 = InStr(s, ".tile.openstreetmap.org/")
If i1 < 10 Then Break
s2 = Mid(s, i1 - 8, 64)
i2 = InStr(s2, "\"><")
ind.Add(Replace(Left(s2, i2 - 1), "\"", Null))
ind.Sort()
s = Mid(s, i1 + i2, RInStr(s, ".png"))
Wend
Print "\nEl mapa es formada de "; ind.Count; " imágenes.\n"
Scarica()
End
Private Procedure Scarica()
If ind.Count = 0 Then Return
Print ind[n], n + 1
' Comunica con el servidor para descargar el fichero imagen:
myhttp.URL = ind[n]
myhttp.Timeout = 15
myhttp.Get()
End
Public Sub myhttp_Read()
Dim sBuf As String
' Vamos a leer el flujo de datos del archivo imagen:
If Lof(MyHTTP) Then
Read #MyHTTP, sBuf, Lof(MyHTTP)
stringa = stringa & sBuf
End If
End
Public Sub MyHTTP_Finished()
Print "Imagen descargada !"
Wait
MyHTTP.Close
' Recreamos el archivo en una carpeta:
File.Save("/tmp" &/ Replace(Right(ind[n], 13), "/", "_"), stringa)
stringa = Null
If n = ind.Max Then
n = 0
ind.Clear()
Button2.Enabled = True
Else
Inc n
Scarica()
Endif
End
Public Sub Button2_Click() ' Permite borrar de la carpeta las imágenes que han sido descargadas.
Dim s As String
For Each s In Dir("/tmp", "*.png", gb.File)
Kill "/tmp" &/ s
Next
End
Private myhttp As New HttpClient As "myhttp"
Private stringa As String
Private ind As New String[]
Private n As Byte
Private we As WebElement
Public Sub Form_Open()
Button1.Text = "Extraer\nlas imágenes"
Button1.Enabled = False
Button2.Text = "Borrar las imágenes\ndescargadas"
Button2.Enabled = False
im = New Image(WebView1.W, WebView1.H)
WebView1.Url = "http://www.openstreetmap.org/#map=5/41.656/14.150"
End
Public Sub WebView1_Load()
Print "Para iniciar la extracción de las imágenes,\nhaz clic en el mapa.\n"
End
Public Sub WebView1_MouseUp()
Dim wf As New WebFrame
n = 0
ind.Clear()
wf = WebView1.Frame
we = wf.Document
Print WebView1.Frame.Url
Print "\nPresionar la tecla "; Quote("Extraer las imágenes"); "."
Button1.Enabled = True
End
Public Sub Button1_Click()
Dim i1, i2 As Integer
Dim s2 As String
Dim s As String = we.HTML
While True
i1 = InStr(s, ".tile.openstreetmap.org/")
If i1 < 10 Then Break
s2 = Mid(s, i1 - 8, 64)
i2 = InStr(s2, "\"><")
ind.Add(Replace(Left(s2, i2 - 1), "\"", Null))
ind.Sort()
s = Mid(s, i1 + i2, RInStr(s, ".png"))
Wend
Print "\nEl mapa es formada de "; ind.Count; " imágenes.\n"
Scarica()
End
Private Procedure Scarica()
If ind.Count = 0 Then Return
Print ind[n], n + 1
' Comunica con el servidor para descargar el fichero imagen:
myhttp.URL = ind[n]
myhttp.Timeout = 15
myhttp.Get()
End
Public Sub myhttp_Read()
Dim sBuf As String
' Vamos a leer el flujo de datos del archivo imagen:
If Lof(MyHTTP) Then
Read #MyHTTP, sBuf, Lof(MyHTTP)
stringa = stringa & sBuf
End If
End
Public Sub MyHTTP_Finished()
Print "Imagen descargada !"
Wait
MyHTTP.Close
' Recreamos el archivo en una carpeta:
File.Save("/tmp" &/ Replace(Right(ind[n], 13), "/", "_"), stringa)
stringa = Null
If n = ind.Max Then
n = 0
ind.Clear()
Button2.Enabled = True
Else
Inc n
Scarica()
Endif
End
Public Sub Button2_Click() ' Permite borrar de la carpeta las imágenes que han sido descargadas.
Dim s As String
For Each s In Dir("/tmp", "*.png", gb.File)
Kill "/tmp" &/ s
Next
End
......funcionará ?