Hi,
I am trying to add multiple features with different values to a collection. I am succeeding in this, buy by making multiple passes through the dbf/shp file. This is extremely inefficient and I am looking for a way to scan the dbf/shp file only once and pull out the features i want based on one of multiple possible values instead of having to scan through once for every unique value.
Code below, and thank you,
Eric
public LayerOverlay defineSSA(ShapeFileFeatureLayer shapefilelayer)
{
Collection<Feature> SSAZipCodes = new Collection<Feature>();
shapefilelayer.Open();
SSAZipCodes.Add(shapefilelayer.QueryTools.GetFeaturesByColumnValue("ZCTA5CE10", "95814")[0]);
SSAZipCodes.Add(shapefilelayer.QueryTools.GetFeaturesByColumnValue("ZCTA5CE10", "95816")[0]);
SSAZipCodes.Add(shapefilelayer.QueryTools.GetFeaturesByColumnValue("ZCTA5CE10", "95811")[0]);
SSAZipCodes.Add(shapefilelayer.QueryTools.GetFeaturesByColumnValue("ZCTA5CE10", "95815")[0]);
SSAZipCodes.Add(shapefilelayer.QueryTools.GetFeaturesByColumnValue("ZCTA5CE10", "95817")[0]);
SSAZipCodes.Add(shapefilelayer.QueryTools.GetFeaturesByColumnValue("ZCTA5CE10", "95818")[0]);
SSAZipCodes.Add(shapefilelayer.QueryTools.GetFeaturesByColumnValue("ZCTA5CE10", "95819")[0]);
SSAZipCodes.Add(shapefilelayer.QueryTools.GetFeaturesByColumnValue("ZCTA5CE10", "95834")[0]);
SSAZipCodes.Add(shapefilelayer.QueryTools.GetFeaturesByColumnValue("ZCTA5CE10", "95822")[0]);
SSAZipCodes.Add(shapefilelayer.QueryTools.GetFeaturesByColumnValue("ZCTA5CE10", "95820")[0]);
SSAZipCodes.Add(shapefilelayer.QueryTools.GetFeaturesByColumnValue("ZCTA5CE10", "95826")[0]);
SSAZipCodes.Add(shapefilelayer.QueryTools.GetFeaturesByColumnValue("ZCTA5CE10", "95691")[0]);
SSAZipCodes.Add(shapefilelayer.QueryTools.GetFeaturesByColumnValue("ZCTA5CE10", "95838")[0]);
SSAZipCodes.Add(shapefilelayer.QueryTools.GetFeaturesByColumnValue("ZCTA5CE10", "95825")[0]);
SSAZipCodes.Add(shapefilelayer.QueryTools.GetFeaturesByColumnValue("ZCTA5CE10", "95821")[0]);
SSAZipCodes.Add(shapefilelayer.QueryTools.GetFeaturesByColumnValue("ZCTA5CE10", "95833")[0]);
SSAZipCodes.Add(shapefilelayer.QueryTools.GetFeaturesByColumnValue("ZCTA5CE10", "95605")[0]);
shapefilelayer.Close();
AreaStyle SSAStyle = new AreaStyle();
SSAStyle.OutlinePen.Color = GeoColor.StandardColors.Blue;
InMemoryFeatureLayer ServiceAreaLayer = new InMemoryFeatureLayer();
ServiceAreaLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = SSAStyle;
ServiceAreaLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
MultipolygonShape PSAPolygon = PolygonShape.Union(SSAZipCodes);
Feature SSA = new Feature(PSAPolygon);
ServiceAreaLayer.InternalFeatures.Add(SSA);
LayerOverlay SSAOverlay = new LayerOverlay();
SSAOverlay.IsBaseOverlay = false;
SSAOverlay.Layers.Add(ServiceAreaLayer);
return SSAOverlay;
}