I have the GPS coordinates is there a script around that can convert the LAT/LON to an actual address or city/town and write to HS log?
Thanks
Thanks
If this is your first visit, be sure to check out the FAQ. You must register before you can post.
IMPORTANT: Your first post will be checked for appropriate content. This may take a bit of time.
Imports System.IO Sub Main(ByVal Parms As Object) Dim APIKey As String = "YourOwnBingAPIKey" Dim Debug as Boolean = True Dim logName = "Bing Geocode" 'set log type for HS log Dim hs_path As String = hs.GetAppPath Dim DebugFile As String = hs_path & "\Logs\DebugFileBing.xml" Dim ParmArray() as String ParmArray = Parms.tostring.split("|") 'split parameter into an array Dim LatLong = ParmArray(0) 'Starting Location: lat,long Dim targetDev as Double = CDbl(ParmArray(1)) 'reference ID of the device for which to update value Try Dim XMLData As New XmlDocument Dim URLString As String = "http://dev.virtualearth.net/REST/v1/Locations/" & LatLong & "?o=xml&key=" & APIKey XMLData.Load(URLString) Dim sNS As String = XMLData.DocumentElement.Attributes("xmlns").Value Dim oNsMgr = New XmlNamespaceManager(XMLData.NameTable) oNsMgr.AddNamespace("def", sNS) If Debug Then If File.Exists(DebugFile) Then File.Delete(DebugFile) XMLData.Save(DebugFile) End If Dim Address As String = XMLData.SelectSingleNode("//def:Name", oNsMgr).InnerText hs.SetDeviceString(targetDev, Address, False) If Debug Then hs.writelog(logName, Address) XMLData = Nothing URLString = Nothing sNS = Nothing oNsMgr = Nothing Address = Nothing Catch ex As Exception : hs.writelog(logName, "Error: " & ex.Message.ToString) End Try ParmArray = Nothing End Sub
Comment