Hi Thinkgeo Team,
I am using PostgreSqlFeatureLayer to query and dissolve features as shown in the code snipet below
publicvoidDissolveDistrict(Persistence.Web.Map.PostgreSqlFeatureLayer layer) {layer.Open();DataTable data = layer.FeatureSource.ExecuteQuery(“select distinct dist_name from iringa_region”);DbfColumn NameColumn =newDbfColumn(“dist_name”, DbfColumnType.String,250,0);PostgreSqlFeatureSource sources =newPostgreSqlFeatureSource(layer.ConnectionString, layer.TableName,“gid”);ThinkGeo.MapSuite.Core.InMemoryFeatureLayer districts =newThinkGeo.MapSuite.Core.InMemoryFeatureLayer();districts.Open();foreach(DataRow dataRowindata.Rows){Collection<AreaBaseShape> polygonShapes =newCollection<AreaBaseShape>();Collection<Feature> features = layer.FeatureSource.GetFeaturesByColumnValue(“dist_name”, System.Convert.ToString(dataRow[0]));foreach(Feature featureinfeatures){AreaBaseShape polygonShape = (AreaBaseShape)feature.GetShape();polygonShapes.Add(polygonShape);}
intcount = polygonShapes.Count;
MultipolygonShape multiPolygonShape = PolygonShape.Union(polygonShapes);Dictionary<string,string> Columns =newDictionary<string,string>();Columns.Add(“dist_name”, System.Convert.ToString(dataRow[0]));Feature newFeature =newFeature(multiPolygonShape, Columns);districts.InternalFeatures.Add(dataRow[0].ToString(),newFeature);}DefaultMap.DynamicOverlay.Layers.Clear();districts.ZoomLevelSet.ZoomLevel02.DefaultTextStyle = TextStyles.Capital3(“dist_name”);districts.ZoomLevelSet.ZoomLevel02.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;districts.ZoomLevelSet.ZoomLevel02.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.StandardColors.Transparent, GeoColor.SimpleColors.PaleGreen);districts.DrawingQuality = DrawingQuality.HighQuality;DefaultMap.DynamicOverlay.Layers.Add(“districts”,districts);DefaultMap.CurrentExtent = districts.GetBoundingBox();districts.Close();}
The result is as shown in the image below
The problem with the resulting layer as seen in the image above is that, it has alot of unwanted dots and lines. I expected to have only 5 polygons with clear area.
Secondly in my codes above there is a line as shown below for lebeling each resulting polygon but the labels are not appearing
districts.ZoomLevelSet.ZoomLevel02.DefaultTextStyle = TextStyles.Capital3(“dist_name”);
Can you please help me where I am going wrong?
Best Regards,
Vincent

