B4J Question How can I upload filtered data in SQLite to bookmarks in Google Map?

Johan Hormaza

Well-Known Member
Licensed User
Longtime User
I make filtered queries in an SQLite table, which contains in certain columns coordinates (Latitude-Longitude) and other types of information. How can I reflect that data in google map bookmarks, since before by means of a FOR cycle and in an excel sheet which contained all the information I loaded the google map bookmarks ?. I really want to do this in SQLite.
Thank you...
 

Johan Hormaza

Well-Known Member
Licensed User
Longtime User
What do you mean with Google Map bookmarks?
Hello, what I want is to create the markers from the information of a SQLite table that I made.
These markers that are seen in the image, are markers made by means of the information of an Excel file.
B4X:
If File.Exists(Connector.mainDos.dirdataExcel, kmlArchivo & ".xls") = True  Then
            Dim m As Marker
            Dim txt As String
            Dim TAB2 As String
            w1.Initialize(Connector.mainDos.dirdataExcel, kmlArchivo & ".xls")
            Sheet = w1.GetSheet(0)
            TAB2 = TAB & TAB
            For i = 1 To Sheet.RowsCount-1
                If Sheet.GetCellValue(11, i) <> 0 And Sheet.GetCellValue(11, i) <> "" Then
                    m = gmap2.AddMarker2(Sheet.GetCellValue(6, i) & "1",Sheet.GetCellValue(7, i) & "1", "Transformador: ",File.GetUri(File.DirAssets, "trafo.png"))
                    AttachInfoWindow(m, "Transformador: " & Sheet.GetCellValue(11, i) & " kva")
                End If
                If Sheet.GetCellValue(1, i) = 70 Then
                    m = gmap2.AddMarker2(Sheet.GetCellValue(6, i),Sheet.GetCellValue(7, i), "Marker #" & i,File.GetUri(File.DirAssets, "blue-pushpin.png"))
           
                Else
                    If Sheet.GetCellValue(1, i) = 150 Then
                        m = gmap2.AddMarker2(Sheet.GetCellValue(6, i),Sheet.GetCellValue(7, i), "Marker #" & i,File.GetUri(File.DirAssets, "grn-pushpin.png"))
               
                    Else
                        If Sheet.GetCellValue(1, i) = 250 Then
                            m = gmap2.AddMarker2(Sheet.GetCellValue(6, i),Sheet.GetCellValue(7, i), "Marker #" & i,File.GetUri(File.DirAssets, "red-pushpin.png"))
                   
                        Else
                            If Sheet.GetCellValue(1, i) = 400 Then
                                m = gmap2.AddMarker2(Sheet.GetCellValue(6, i),Sheet.GetCellValue(7, i), "Marker #" & i,File.GetUri(File.DirAssets, "pink-pushpin.png"))
                   
                            Else
                                If Sheet.GetCellValue(1, i) = 1000 Then
                                    m = gmap2.AddMarker2(Sheet.GetCellValue(6, i),Sheet.GetCellValue(7, i), "Marker #" & i,File.GetUri(File.DirAssets, "wht-pushpin.png"))
                                Else
                                    m = gmap2.AddMarker2(Sheet.GetCellValue(6, i),Sheet.GetCellValue(7, i), "Marker #" & i,File.GetUri(File.DirAssets, "ylw-pushpin.png"))
                                End If
                            End If
                        End If
                    End If
                End If

                txt = "Potencia W: "& Sheet.GetCellValue(1, i)
                txt = txt & TAB2 & "Código: " & Sheet.GetCellValue(2, i)
                txt = txt & TAB2 & "Dirección: "& Sheet.GetCellValue(0, i)
                txt = txt & TAB2 & "Tipo: "& Sheet.GetCellValue(4, i)
                txt = txt & TAB2 & "Observaciones: "& Sheet.GetCellValue(5, i)
                txt = txt & TAB2 & "Hora: "& Sheet.GetCellValue(8, i)
                txt = txt & TAB2 & "Fecha: " & Sheet.GetCellValue(9, i)

                AttachInfoWindow(m, txt)
                MarkerList.Add(m)
            Next
This is the code to create the marks seen in the image, and I would like to do the same but with information from a table in SQLite, read each cell, rows as I did in the excel code.
 

Attachments

  • macadoresKML.jpg
    macadoresKML.jpg
    126.6 KB · Views: 429
Last edited:
Upvote 0

Johan Hormaza

Well-Known Member
Licensed User
Longtime User
Thank you, but in what way I would implement it in a FOR ... NEXT cycle to extract the information from each row and column.
Regards...
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Sorry, sometimes I mix up the products.
But, anyway, most of the information there is the same for B4J.
The main difference is the Cursor object in B4A which doesn't exist in B4J.
In B4J, you must use RecordSet, which exist also in B4A.
You may have a look at the B4i SQLite examples, they are similar to B4J.
I have a B4x SQLite booklet in the pipeline.
 
Upvote 0

Johan Hormaza

Well-Known Member
Licensed User
Longtime User
Thanks Klaus, I can do something similar to the code like the one in # 2 that I did with Excel but now I want to do it with SQLite?
thanks...
 
Upvote 0
Top