/// <summary> /// Parses a Geometry of specific type from the WKT string. /// </summary> /// <typeparam name="T">The type of the Geometry to be parsed.</typeparam> /// <param name="wkt">The string with WKT representation of a Geometry.</param> /// <returns>The parsed Geometry of given type.</returns> public static T Parse <T>(string wkt) where T : Geometry { Geometry parsed = WktReader.Parse(wkt); if (parsed != null) { T result = parsed as T; if (result == null) { throw new WktParseException("Input doesn't contain valid WKB representation of the specified geometry type."); } return(result); } else { return(null); } }