Upload
schneider-electric
View
366
Download
0
Embed Size (px)
Citation preview
Stump the Expert
December 2015
THANK YOU!Together, we are stronger!
15+ years of innovation, collaboration, evolution, and success!
Q&A
Weather Information
Function GetLatLngFromAddress(address)Dim Lat, Lng, urlurl = "http://maps.googleapis.com/maps/api/geocode/xml?address=" & addressLat = GetXMLNodeValue(url, "result/geometry/location/lat")Lng = GetXMLNodeValue(url, "result/geometry/location/lng")GetLatLngFromAddress = Lat & "," & Lng
End Function
Function GetXMLNodeValue(url, nodePath)Dim oXML, oNode, retSet oXML = CreateObject("Microsoft.XMLDOM")oXML.async = FalseCall oXML.load(url)Set oNode = oXML.documentElement.selectSingleNode(nodePath)ret = oNode.TextGetXMLNodeValue = ret
End Function
Function GetMetarAviationWeather(address, variableName)Dim latLng, lat, lng, url, nodePathlatLng = Split(GetLatLngFromAddress(address), ",")lat = latLng(0)lng = latLng(1)url = "https://www.aviationweather.gov/adds/dataserver_current/httpparam?
dataSource=metars&requestType=retrieve&format=xml&radialDistance=20;" & lng & "," & lat & "&hoursBeforeNow=3"nodePath = "data/METAR/" & variableNameGetMetarAviationWeather = GetXMLNodeValue(url, nodePath)
End Function
Dim variableNamevariableName = "temp_c"$w.temp = GetMetarAviationWeather($w.address, variableName)variableName = "dewpoint_c"$w.dp = GetMetarAviationWeather($w.address, variableName)$w.rh = 100 - 5*($w.temp - $w.dp)
THANK YOU!