Ethan,
Here is the code we use now, let me know if you have more questions:
Imports ThinkGeo.MapSuite.Layers
Namespace ArcGISRestLayers
Public Class RecentWeatherRadarArcGIS
Inherits ArcGISRestLayerBase
#Region " Local Fields "
Private _arcGISLayer As ArcGISServerRestLayer
Private _serviceData As New nowCoastServices.RecentWeatherRadarImagery
Private _layerDataDate As Date
Private Const LAYER_NAME As String = "radar_meteo_imagery_nexrad_time"
Private WithEvents _updateTimer As New Timer
#End Region
#Region " Properties "
Public Overrides ReadOnly Property ArcGISRestLayer As ArcGISServerRestLayer
Get
Return Me._arcGISLayer
End Get
End Property
Private _updated As Boolean = False
Public Overrides ReadOnly Property DataUpdated As Boolean
Get
Return Me._updated
End Get
End Property
Public Overrides ReadOnly Property LayerDataDate As Date
Get
Return Me._layerDataDate
End Get
End Property
Public Overrides ReadOnly Property UpdateMinutes As Integer
Get
Return Me._serviceData.UpdateMinutes
End Get
End Property
Public Overrides ReadOnly Property URL As String
Get
Return Me._serviceData.ExportURL
End Get
End Property
#End Region
#Region " Ctor "
Public Sub New()
Me._updateTimer.Interval = 60000 * 4
End Sub
#End Region
#Region " Public Methods "
Public Overrides Sub InitializeService()
Me.InitArcGISServerRestLayer()
End Sub
#End Region
#Region " Private Methods "
Private Sub InitArcGISServerRestLayer()
Me._updateTimer.Stop()
Me._updated = False
Try
' Sets our parameters for image format.
Me._arcGISLayer = New ArcGISServerRestLayer(Me._serviceData.ExportURI) With {
.ImageFormat = ArcGISServerRestLayerImageFormat.Png8 '; // we can use the Property 'ImageFormat' instead of the 'format' in parameters. When they coexist, the property is perferred.
}
AddHandler Me._arcGISLayer.SendingWebRequest, AddressOf Me.Agrl_SendingWebRequest
' Sets our parameters for transparency
Me._arcGISLayer.Parameters.Add("transparent", "true")
' Specifies the layerId(s) you wish to display. 0,1,2 etc
Me._arcGISLayer.Parameters.Add("layers", "show:3") 'layer 3 is the radar graphic without region borders
'Me._arcGISLayer.Parameters.Add("validtime", Now.AddMinutes(-60))
' Specifies the layer and field you wish to query(layerid: field). in this example, the layerid is 2 and the data field to query is POP1999.
'arcGisLayer.Parameters.Add("layerdefs", String.Format("2:POP1999{0}", "> 100000"))
Me._arcGISLayer.IsVisible = True
Me._layerDataDate = Me.GetImageDate(LAYER_NAME, 3)
Catch ex As Exception
End Try
Me._updateTimer.Start()
End Sub
Private Sub GetImage(ByVal URL As String) 'As System.Drawing.Image
Dim radarURL As String '= "https://nowcoast.noaa.gov/arcgis/rest/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer/export"
radarURL = "https://nowcoast.noaa.gov/arcgis/rest/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer/export?bbox=-169.8.15.4.-63.5,60.5&bboxSR=&layers=show:3&layerDefs=&size=&imageSR=&format=png&transparent=false&dpi=400&time=&layerTimeOptions=&dynamicLayers=&gdbVersion=&mapScale=&f=image"
Dim Request As System.Net.HttpWebRequest = Net.HttpWebRequest.Create(radarURL)
Dim Response As System.Net.HttpWebResponse
Dim ll As Int16 = 1
Response = CType(Request.GetResponse, System.Net.WebResponse)
If Request.HaveResponse Then
If Response.StatusCode = Net.HttpStatusCode.OK Then
Dim anImage As Image = System.Drawing.Image.FromStream(Response.GetResponseStream)
anImage.Save("d: \holder\radar.png")
End If
End If
End Sub
Private Sub _updateTimer_Tick(sender As Object, e As EventArgs) Handles _updateTimer.Tick
Me._layerDataDate = Me.GetImageDate(LAYER_NAME, 3)
Me._updated = True
End Sub
Protected Overrides Sub Dispose(disposing As Boolean)
Me._updateTimer.Stop()
Me._updateTimer.Dispose()
End Sub
#End Region
End Class
End Namespace
Namespace nowCoastServices
Public Class RecentGOESWeatherSateliteImagery
Implements InowCoastService
Private Const URL As String = "https://nowcoast.noaa.gov/arcgis/rest/services/nowcoast/sat_meteo_imagery_time/MapServer"
Public ReadOnly Property ServiceURL As String Implements InowCoastService.ServiceURL
Get
Return URL
End Get
End Property
Public ReadOnly Property ServiceURI As Uri Implements InowCoastService.ServiceURI
Get
Return New Uri(URL)
End Get
End Property
Public ReadOnly Property ExportURL As String Implements InowCoastService.ExportURL
Get
Return Me.ServiceURL & "/export"
End Get
End Property
Public ReadOnly Property ExportURI As Uri Implements InowCoastService.ExportURI
Get
Return New Uri(Me.ServiceURL & "/export")
End Get
End Property
Public ReadOnly Property UpdateMinutes As Integer Implements InowCoastService.UpdateMinutes
Get
Return 10
End Get
End Property
End Class
End Namespace
nowCoastRestLayer.InitializeService()
'add and show
Me._NOAAOverlay.Layers.Add(nowCoastRestLayer.URL, nowCoastRestLayer.ArcGISRestLayer)
Me._NOAAOverlay.IsVisible = True