Don,
The file is located here:
http://www.nhc.noaa.gov/gis/kml/surge/WatchWarningSS_latest.kml
Here is the code that is used to show it. Two things happen here: first, I have to strip out value between any Placemark-name and /name i the KML, so that it doesn’t show on the map. Secondly, the code builds the index files before creating and adding the KMLFeatureLayer
'remove Placemark-name from kml file
Try
Dim reader As New IO.StreamReader(surgeFile)
Dim fileText As String = reader.ReadToEnd
reader.Close()
Dim plStart As Integer = 0
Dim plEnd As Integer
While plStart >= 0
plStart = fileText.IndexOf("<Placemark><name>", plStart)
If plStart > 0 Then
plEnd = fileText.IndexOf("</name>", plStart)
fileText = fileText.Remove(plStart + 17, plEnd - (plStart + 17))
End If
If plStart > 0 Then plStart += 1
End While
Dim writer As New IO.StreamWriter(surgeFile)
writer.Write(fileText)
writer.Close()
Catch ex As Exception
RaiseEvent SendMessage("Error editing Surge Watch/Warnings file")
Me._kmlShown = False
Return
End Try
Dim layerOverlay As New LayerOverlay()
KmlFeatureSource.BuildIndexFile(surgeFile)
Dim kmlLayer As New KmlFeatureLayer(surgeFile) '(surgeFile, KmlStylingType.EmbeddedStyling)
kmlLayer.FeatureSource.Projection = proj4
kmlLayer.ZoomLevelSet.ZoomLevel04.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level09
kmlLayer.IsVisible = Me.MapZoomLevel < 10
kmlLayer.Transparency = 255
kmlLayer.Name = "KML255"
kmlLayer.DrawingQuality = DrawingQuality.HighQuality
layerOverlay.Layers.Add(kmlLayer.Name, kmlLayer)
kmlLayer = New KmlFeatureLayer(surgeFile) ', KmlStylingType.EmbeddedStyling)
kmlLayer.FeatureSource.Projection = proj4
kmlLayer.ZoomLevelSet.ZoomLevel10.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
kmlLayer.IsVisible = Me.MapZoomLevel >= 10
kmlLayer.Transparency = 150
kmlLayer.Name = "KML150"
kmlLayer.DrawingQuality = DrawingQuality.HighQuality
layerOverlay.Layers.Add(kmlLayer.Name, kmlLayer)
layerOverlay.Name = layerName
Me.Map.Overlays.Add(layerName, layerOverlay)
Me.Map.Refresh()
Our map unit is Meters, and the projection used is a Proj4Projection. This KML file will be along the Texas coast.