private void LoadBoundary(String FileName, bool Counties) { CoordinateTransformationFactory ctfac = new CoordinateTransformationFactory(); ICoordinateSystem SourceProj = ProjNet.Converters.WellKnownText.CoordinateSystemWktReader.Parse(File.ReadAllText(FileName.ToLower().Replace(".shp", ".prj"))) as ICoordinateSystem; ICoordinateSystem DestProj = GeographicCoordinateSystem.WGS84; ICoordinateTransformation XF = ctfac.CreateFromCoordinateSystems(SourceProj, DestProj); using (ShapeFile sF = ShapeFile.Open(FileName)) foreach (Shape shp in sF.GetAllShapes()) { Sim_Boundary NewBoundary = new Sim_Boundary(shp, XF, this); if (Counties) { Boundaries.Add(NewBoundary); } else if (NewBoundary.Contains(Boundaries[0])) { NewBoundary.Name = "STATE"; Boundaries.Add(NewBoundary); } } if (Counties) { Centroid_X /= CoordinateCount; Centroid_Y /= CoordinateCount; } }