Access 2007 table or query conversion in .kml file and view in Google Earth

This is working example of my code that converts Access 2007 table or query in
Google Earth .kml file
It is fully functional and I’m using it in my sales database.

Of course you should have stored coordinates – longitude/latitude
also – name and description of poi database which have to be exported.

[php]
Private Sub Command0_Click()

DoCmd.OpenQuery "QrySim"

Dim MyDB As DAO.Database
Dim MyRS As DAO.Recordset

Dim fld As Field
Dim strText As String
Dim MyTableName As String
Dim QryOrTblDef As String
Dim iFile As Integer

QryOrTblDef = "QrySim"
Set MyDB = CurrentDb
Set MyRS = MyDB.OpenRecordset(QryOrTblDef)
iFile = FreeFile

Open "C:\Documents and Settings\ivantassev.UMC\Desktop\EXCELtoKML\DB\KMLIvan.kml" For Output Shared As #iFile

Print #iFile, "<?xml version=""1.0"" encoding=""utf-8""?>"
Print #iFile, "<kml xmlns=""http://earth.google.com/kml/2.0"">"
Print #iFile, "<Document>"

Print #iFile, " <Folder>"
Print #iFile, " <name>QrySim</name>"
With MyRS
Do Until .EOF

Print #iFile, " <Placemark>"
strText = " <description><![CDATA[" & MyRS.Fields(1) & "]]></description>"
Print #iFile, strText

strText = " <name><![CDATA[" & MyRS.Fields(0) & "]]></name>"

Print #iFile, strText

Print #iFile, "<Point>"

strText = "<coordinates>" & MyRS.Fields(3) & "," & MyRS.Fields(2) & ",0</coordinates>"

Print #iFile, strText
Print #iFile, " </Point>"
Print #iFile, " </Placemark>"
.MoveNext
Loop
End With

Print #iFile, " </Folder>"
Print #iFile, " </Document>"
Print #iFile, "</kml>"

Close #iFile
MyRS.Close
Set MyRS = Nothing
Set MyDB = Nothing

‘resest the recordset and database to blank

‘launches google earth
Call Shell("explorer.exe " & "C:\Documents and Settings\ivantassev.UMC\Desktop\EXCELtoKML\DB\KMLIvan.kml", vbNormalFocus)
End Sub
[/php]

It is posible using the princip of this code also to export any kind of POI formats – .gpx , .plt and etc.
If you have any questions I opened a topic here.

Google Earth: An Illustrated History of the World

Robert Rosenberg recently emailed us to let us know about a very ambitious new project he’s working on, called the Illustrated History of the World. In his words:

The IHW project is the Foundation’s effort to bring together existing multi-media web content such as Google Earth, You Tube, and Wikipedia in order to create an interactive narrative of world history based upon the content of our Tables of Instances.

tribus.jpg

If things go as well as they’re hoping, the result could be a very useful resource for teachers and students to help supplement their history and geography lessons.

As of now, the project is a bit cumbersome to load on your computer, as the main KMZ file is roughly 108MB! They’re already working on ways to reduce the size of that, likely putting it into a network link so it can be loaded in smaller chunks as needed. The other advantage to using a network link is that the data can be automatically updated, rather than requiring the user to re-download it from their site.

You can learn more on their website at TribusOrganum.org. They’ve also started a thread in the Google Earth Community to help solicit more feedback.