Imports System.Collections Imports ThinkGeo.MapSuite.Core Imports ThinkGeo.MapSuite.WebEdition Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then ctlDirMap.MapUnit = GeographyUnit.DecimalDegree ctlDirMap.PanZoomBar.Enabled = True ctlDirMap.LayerSwitcher.Enabled = True ctlDirMap.MousePosition.Enabled = True ctlDirMap.BackgroundMap.YahooMap.Name = "Yahoo Demo" ctlDirMap.BackgroundMap.YahooMap.YahooMapType = YahooMapType.Regular ctlDirMap.CurrentExtent = New RectangleShape(-94.64456, 39.13578, -94.4674, 39.03605) End If End Sub Protected Sub btnShow5295_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnShow5295.Click Dim gistList() As Integer = { _ 1208, 1211, 1067, 1068, 1069, 1216, 1221, 1222, 1223, 1224, 1228, 1231, _ 1233, 1234, 1241, 1070, 1242, 1243, 1244, 1252, 1254, 1255, 1256, 1257, _ 1258, 1259, 1260} Dim lastUSState As String = String.Empty Dim zipMapSourcePath As String = ConfigurationManager.AppSettings("zipMapPath") Dim zipSource As ShapeFileFeatureSource = Nothing Dim featureCnt As Integer = 0 Dim zipShapes As New System.Collections.ObjectModel.Collection(Of AreaBaseShape) Dim zipFeature As Feature Try Dim stopWatch As New System.Diagnostics.Stopwatch stopWatch.Start() zipSource = New ShapeFileFeatureSource("C:\Documents and Settings\baiyiming\My Documents\Visual Studio 2008\Projects\NullColumnForTextStyle\Data\CAzcta5cu.shp") zipSource.Open() For Each gist As Integer In gistList featureCnt += 1 zipFeature = zipSource.GetFeatureById(gist.ToString, New String() {"GIST_ID", "COUNTY", "ZCTA"}) zipFeature.ColumnValues.Add("DIRNUM", String.Format("{0:000000}", 5295)) zipShapes.Add(zipFeature.GetShape()) Next zipSource.Close() Dim combinedZips As MultipolygonShape = AreaBaseShape.Union(zipShapes) System.Diagnostics.Debug.WriteLine("Elapsed milliseconds = " & stopWatch.ElapsedMilliseconds) Dim mapShapeLayer As New InMemoryLayer mapShapeLayer.Open() mapShapeLayer.Name = "D5295" mapShapeLayer.FeatureSourceColumns.Add(New FeatureSourceColumn("GIST_ID", "Integer", 8)) mapShapeLayer.FeatureSourceColumns.Add(New FeatureSourceColumn("COUNTY", "String", 5)) mapShapeLayer.FeatureSourceColumns.Add(New FeatureSourceColumn("ZCTA", "String", 5)) mapShapeLayer.FeatureSourceColumns.Add(New FeatureSourceColumn("DIRNUM", "String", 6)) ''''''''''''''''''''''''''''''''''''''''''' Dim dict As New System.Collections.Generic.Dictionary(Of String, String) dict.Add("DIRNUM", "5295") mapShapeLayer.Features.Add("5295", New Feature(combinedZips, "5295", dict)) ''''''''''''''''''''''''''''''''''''''''''''''''''' 'mapShapeLayer.Features.Add("5295", New Feature(combinedZips, "5295")) mapShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColor.FromArgb(255, GeoColor.SimpleColors.Black) mapShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(150, GeoColor.SimpleColors.Gold) mapShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.City1("DIRNUM") mapShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20 mapShapeLayer.Close() ctlDirMap.DynamicLayers.Add("D5295", mapShapeLayer) mapShapeLayer.Open() ctlDirMap.CurrentExtent = mapShapeLayer.GetBoundingBox() mapShapeLayer.Close() Catch ex As Exception Response.Write("Error occurred in map generation - " & ex.Message) End Try End Sub End Class