NOAA WebService #1
Over the last few weeks, I've been using my spare time (I call lunch break my spare time) to write an application against the NOAA WebService. Earlier this year, NOAA made the data available in XML as a test, called the National Digital Forecast Database. Now anyone can get information in an XML format directly from the National Digital Forecast Database website. My initial attempts to create an Infopath form against this webservice failed since it uses RPC Encoded instead of Document literal format. I then ventured to write an Excel Solution using VSTO. My initial attempts were not very successful since I was receiving ill-formed XML. I did however have some success last night with the call to the webservice. I will post the complete solution up here when its ready. This is how I made the call:
Imports System.Windows.Forms
Imports System.Xml
Imports Office = Microsoft.Office.Core
Imports Excel = Microsoft.Office.Interop.Excel
Imports MSForms = Microsoft.Vbe.Interop.Forms
<code snipped>
Private Sub getWeather(ByVal Sh As Object)
Dim sheet As Excel.Worksheet = CType(Sh, Excel.Worksheet)
Dim weatherWS As New gov.noaa.nws.www.ndfdXML
Dim weatherInfo As String
Dim WeatherXML As New XmlDocument
Dim WeatherXMLElement As XmlElement
Dim longitude As Integer = 122 <- these values will be picked up from Excel and eventually from MapPoint
Dim latitude As Integer = 47
Dim startTime As DateTime
startTime = DateTime.Now
Try
weatherInfo = weatherWS.NDFDgenByDay(latitude, longitude, startTime, 1, gov.noaa.nws.www.formatType.Item12hourly)
Catch ex As Exception
sheet.Cells(3, "I") = ex.Message
sheet.Cells(4, "J") = ex.StackTrace
sheet.Cells(5, "K") = ex.TargetSite
End Try
WeatherXML.LoadXml(weatherInfo)
<code snipped> <- Im still working on parsing the XML String
End Sub
Comments
- Anonymous
December 21, 2004
When you get this VSTO solution grabbing data from the NOAA web service, integrating it with MapPoint, and probably with a GPS device, then you will certainly be "Doing Seriously Cool S@$!". You have got to post the code and some screen shots of the solution. Maybe a few along the way to building it to keep us geeks interested and involved in your dev project.
Nice work! - Anonymous
January 13, 2005
I'm trying to run the NOAA webservice on Richmond,VA,, and it's giving me this message:
latitude must between 55N and 15N
long is 33.752504
lat is -84.3888463
Come across this before? - Anonymous
June 03, 2005
I decided to rewrite the Excel VSTO app that I was writing&nbsp;as a MapPoint AddIn. I am using VS 2003...