/// <summary> /// Creates a new geometry from JSON. /// </summary> /// <param name="json"></param> /// <returns></returns> public static Geometry ToGeometry(string json) { if (json == null) { return(null); } if (json.Contains("x") && json.Contains("y")) { return(Point.FromJson(json)); } if (json.Contains("points")) { return(Multipoint.FromJson(json)); } if (json.Contains("paths")) { return(Polyline.FromJson(json)); } if (json.Contains("rings")) { return(Polygon.FromJson(json)); } throw new ArgumentException("This geometry type is not supported.", nameof(json)); }