David, your merge code worked wonderfully. The features are merged together very, very quickly. Thank you very much.
The problem I'm having now is one that I reported under the heading "Deployment Problem" yesterday. I've now been able to reproduce it in development. What happens is, after I merge the features I put the merged feature on an in-memory layer and add that to the map control. The map zooms to the proper extent, but no feature is displayed and if I attempt to zoom or scroll the map fills with a pink color and a broken image icon appears in the top left corner.
I created a test app that produces the problem. The code is below:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register assembly="WebEdition" namespace="ThinkGeo.MapSuite.WebEdition" tagprefix="cc1" %>
w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
w3.org/1999/xhtml">
Untitled Page
<form> id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel runat="server" ID="upnlMap" UpdateMode="Conditional">
<ContentTemplate>
<cc1:Map ID="ctlDirMap" runat="server" height="768px" width="1024px"></cc1:Map>
<asp:Button runat="server" ID="btnShow5295" Text="Show Dir #5295" />
</ContentTemplate>
</asp:UpdatePanel>
</form>
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:\MapFiles\CA\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))
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
Thanks for your help so far.
Bob Mc.