public OS50kGazetteer(string line) { line = EnhancedTextInfo.RemoveDiacritics(line); // remove any special characters for Gazatteer processing string[] values = line.Split(':'); int.TryParse(values[0], out int intval); SequenceNumber = intval; DefinitiveName = values[2]; int.TryParse(values[4], out intval); double.TryParse(values[5], out double latitude); Latitude = intval + latitude / 60; int.TryParse(values[6], out intval); double.TryParse(values[7], out double longitude); Longitude = intval + longitude / 60; if (values[10] == "W") { Longitude = -1 * Longitude; // West Longitudes are negative } Coordinate c = new Coordinate(Longitude, Latitude); c = MapTransforms.TransformCoordinate(c); Point = GeometryFactory.Default.CreatePoint(c); CountyCode = values[11]; CountyName = values[13]; FeatureCode = values[14]; ParishName = values[20]; if (ParishName.EndsWith(" CP")) { ParishName = ParishName.Substring(0, ParishName.Length - 3); } if (ParishName.EndsWith(" Community")) { ParishName = ParishName.Substring(0, ParishName.Length - 10); } FixCommas(); FixAbbreviations(); ModernCounty county = Regions.OS_GetCounty(CountyCode); if (county == null) { CountryName = string.Empty; } else { CountryName = county.CountryName; DoubleMetaphone meta = new DoubleMetaphone(DefinitiveName); FuzzyMatch = meta.PrimaryKey + ":"; FuzzyNoParishMatch = meta.PrimaryKey + ":"; meta = new DoubleMetaphone(ParishName); FuzzyMatch += meta.PrimaryKey + ":"; meta = new DoubleMetaphone(CountyName); FuzzyMatch += meta.PrimaryKey + ":"; FuzzyNoParishMatch = meta.PrimaryKey + ":"; meta = new DoubleMetaphone(county.CountryName); FuzzyMatch += meta.PrimaryKey; FuzzyNoParishMatch = meta.PrimaryKey + ":"; } }
//public static IMathTransform MathTransform //{ // get { return Transform().MathTransform; } //} public static GeoResponse.CResult.CGeometry.CViewPort TransformViewport(GeoResponse.CResult.CGeometry.CViewPort viewport) { Coordinate mNorthEast = MapTransforms.TransformCoordinate(new Coordinate(viewport.NorthEast.Long, viewport.NorthEast.Lat)); Coordinate mSouthWest = MapTransforms.TransformCoordinate(new Coordinate(viewport.SouthWest.Long, viewport.SouthWest.Lat)); GeoResponse.CResult.CGeometry.CViewPort result = new GeoResponse.CResult.CGeometry.CViewPort(); result.NorthEast.Long = mNorthEast.X; result.NorthEast.Lat = mNorthEast.Y; result.SouthWest.Long = mSouthWest.X; result.SouthWest.Lat = mSouthWest.Y; return(result); }